function db_result

Same name in this branch
  1. 6.x drupal-6.x/includes/database.mysqli.inc \db_result()
  2. 6.x drupal-6.x/includes/database.mysql.inc \db_result()
  3. 6.x drupal-6.x/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().

Return value

The resulting field or FALSE.

Related topics

120 calls to db_result()
actions_function_lookup in drupal-6.x/includes/actions.inc
Given an md5 hash of a function name, return the function name.
aggregator_block in drupal-6.x/modules/aggregator/aggregator.module
Implementation of hook_block().
block_add_block_form_validate in drupal-6.x/modules/block/block.admin.inc
block_admin_configure_validate in drupal-6.x/modules/block/block.admin.inc
block_flush_caches in drupal-6.x/modules/block/block.module
Implementation of hook_flush_caches().

... See full list

Archivo

drupal-6.x/includes/database.mysql.inc, line 183
Database interface code for MySQL database servers.

Código

function db_result($result) {
  if ($result && mysql_num_rows($result) > 0) {
    // The mysql_fetch_row function has an optional second parameter $row
    // but that can't be used for compatibility with Oracle, DB2, etc.
    $array = mysql_fetch_row($result);
    return $array[0];
  }
  return FALSE;
}