23 June 2011

How to get node ids of certain content type in Drupal.

Source code viewer
  1. $result = db_query("SELECT nid FROM node WHERE type = 'content_type_machine_name'");
  2.  
  3. foreach ($result as $record)
  4. {
  5. echo $record->nid;
  6. }
Programming Language: PHP