WHERE MySQL clause not working in Drupal 6 I am writing a Drupal Module and I have encountered a problem. This is my code:

$query3 = db_query("SELECT nid FROM {node} WHERE uid=19");
var_dump(db_result($query3));


It currently returns: bool(false)

Now when I run this query in phpmyadmin it returns the desired nid (47) - no problem.

What am I doing wrong?
Try

$query3 = db_query("SELECT nid FROM {node} WHERE uid = '%d'", 19);


this is the proper way to handle variables in the db_query, as it prevents sql injection.

//grab the current user
global $user;
$query3 = db_query("SELECT nid FROM {node} WHERE uid = '%d'", $user-&gt;uid);