-
db_query() and db_placeholders() example #1
Have you ever wondered how to properly build a query like this in Drupal:
1SELECT nid, type, title FROM node n WHERE n.type IN('page','story');This requires the use of db_placeholders() to create the placeholder ‘ ‘, ‘ ‘, etc.
1$result = db_query('SELECT nid, type, title FROM {node} n WHERE n.type IN(' . db_placeholders($node_types, 'text') . ')', $node_types);where $node_types is an array of node types.