function db_result
6.x database.pgsql.inc | db_result($result) |
6.x database.mysqli.inc | db_result($result) |
6.x database.mysql.inc | db_result($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().
File
- drupal-6.x/
includes/ database.mysqli.inc, line 183 - 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) {
if ($result && mysqli_num_rows($result) > 0) {
// The mysqli_fetch_row function has an optional second parameter $row
// but that can't be used for compatibility with Oracle, DB2, etc.
$array = mysqli_fetch_row($result);
return $array[0];
}
return FALSE;
}