Return to Snippet

Revision: 21795
at December 21, 2009 11:53 by ReeceMarsland


Initial Code
$values = array(1, 2, 3, 4, 5);

$placeholders = db_placeholders($values);

$result = db_query("SELECT t.s FROM {table} t WHERE t.field IN ($placeholders)", $values); 

$items = array();
while ($row = db_fetch_object($result)) {
  $items[] = l($row->title, "node/{$row->s}");
}

Initial URL

                                

Initial Description

                                

Initial Title
Drupal db_query example

Initial Tags
mysql, php, drupal

Initial Language
PHP