db_query() not compatible with IN operator? I ran into a snag setting placeholders for the IN operator, and then I ran into a webpage that basically says, if I'm reading it correctly, that they are not compatible. I also found a forum post on this subject in which the questioner gave up and expanded his IN into a series of ORs.

Apparently, I have the choice of either expanding the IN into ORs or learning to do dynamic queries. Since db_select() apparently comes with a lot of overhead, I suppose the ORs will run faster.

Is this correct, or is there a way to use IN with db_query?
You can use placeholders in IN conditions, but you need to set them up correctly first.  Using the example in your first link, this should work:

$replacement_values = array();
foreach(array_values($your_values) as $i =&gt; $val) {
  $replacement_values['@val' . $i] = $val;
}
// Should look something like:
// $replacement_values = array(
//   '@val1' =&gt; 'your first value',
//   '@val2' =&gt; 'your second value',
// );

$placeholders = array_keys($replacement_values);
$placeholders = implode(', ', $placeholders);
// Should look something like:
// $placeholders = '@val1, @val2';

$res = db_query('SELECT field FROM {table} WHERE cond_field in(' . $placeholders . ')', $replacement_values);


n.b. I haven't tested this so it might need some tweaking.

That said, I'd urge you to look into dynamic queries.  They're not that hard to get your head around and if you wan't to right modules that might ever be used on another Drupal site that uses an alternative database to MySQL then they are a must.