Closed (won't fix)
Project:
Drupal core
Version:
6.x-dev
Component:
database system
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
29 Jun 2007 at 21:58 UTC
Updated:
29 Jun 2007 at 22:09 UTC
This is how I implented this for mysql.
This routine is sometimes useful.
/**
* Fetch the first and only field from result row from the previous query.
*
* @param $result
* A database query result resource, as returned from db_query().
* @return
* A single value from the row or null.
*/
function db_fetch_value($result) {
if ($result) {
$row = mysql_fetch_row($result);
if ( $row ) return ( $row[0] );
else return(null);
}
}
Comments
Comment #1
yched commented??
db_result() function already exists in drupal API.
Plus you should really not use such functions as mysql_fetch_row in drupal code (unless maybe you know exactly what you are doing). Use drupal db_api instead