You are here

function db_result in Drupal 5

Same name in this branch
  1. 5 includes/database.mysqli.inc \db_result()
  2. 5 includes/database.mysql.inc \db_result()
  3. 5 includes/database.pgsql.inc \db_result()
Same name and namespace in other branches
  1. 4 includes/database.mysqli.inc \db_result()
  2. 4 includes/database.mysql.inc \db_result()
  3. 4 includes/database.pgsql.inc \db_result()
  4. 6 includes/database.mysqli.inc \db_result()
  5. 6 includes/database.mysql.inc \db_result()
  6. 6 includes/database.pgsql.inc \db_result()

Return an individual result field from the previous query.

Only use this function if exactly one field is being selected; otherwise, use db_fetch_object() or db_fetch_array().

Parameters

$result: A database query result resource, as returned from db_query().

$row: The index of the row whose result is needed.

Return value

The resulting field or FALSE.

Related topics

66 calls to db_result()
aggregator_block in modules/aggregator/aggregator.module
Implementation of hook_block().
comment_multiple_delete_confirm in modules/comment/comment.module
List the selected comments and verify that the admin really wants to delete them.
comment_nodeapi in modules/comment/comment.module
Implementation of hook_nodeapi().
comment_num_all in modules/comment/comment.module
comment_num_new in modules/comment/comment.module
get number of new comments for current user and specified node

... See full list

File

includes/database.mysqli.inc, line 218
Database interface code for MySQL database servers using the mysqli client libraries. mysqli is included in PHP 5 by default and allows developers to use the advanced features of MySQL 4.1.x, 5.0.x and beyond.

Code

function db_result($result, $row = 0) {
  if ($result && mysqli_num_rows($result) > $row) {
    $array = mysqli_fetch_array($result, MYSQLI_NUM);
    return $array[0];
  }
  return FALSE;
}