Drupal db_query example


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. $values = array(1, 2, 3, 4, 5);
  2.  
  3. $placeholders = db_placeholders($values);
  4.  
  5. $result = db_query("SELECT t.s FROM {table} t WHERE t.field IN ($placeholders)", $values);
  6.  
  7. $items = array();
  8. while ($row = db_fetch_object($result)) {
  9. $items[] = l($row->title, "node/{$row->s}");
  10. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.