Using IN clause in db_query
You are missing the braces.

Try this:

$nids = array(1, 2, 3);
$result = db_query('SELECT * FROM {node} WHERE nid IN (:nids)', array(':nids' =&gt; $nids));


For more information, see http://drupal.org/node/310072, especially the chapter on Placeholder arrays:


  Placeholder arrays
  
  Drupal's database layer includes an extra feature of placeholders. If the value passed in for a placeholder is an array, it will be automatically expanded into a comma separated list as will the corresponding placeholder. That means developers do not need to worry about counting how many placeholders they will need.
  
  An example should make this behavior clearer:

&lt;?php
// This code:
db_query("SELECT * FROM {node} WHERE nid IN (:nids)", array(':nids' =&gt; array(13, 42, 144));

// Will get turned into this prepared statement equivalent automatically:
db_query("SELECT * FROM {node} WHERE nid IN (:nids_1, :nids_2, :nids_3)", array(
  ':nids_1' =&gt; 13, 
  ':nids_2' =&gt; 42, 
  ':nids_3' =&gt; 144,
));

// Which is equivalent to the following literal query:
db_query("SELECT * FROM {node} WHERE nid IN (13, 42, 144)");
?&gt;