bratsun
8/27/2014 - 9:57 PM

Fetch nodes from DB

Fetch nodes from DB

$nids = db_select('node', 'n')
  ->fields('n', array('nid'))
  ->fields('n', array('type'))
  ->condition('n.type', 'blog')
  ->execute()
  ->fetchCol(); // returns an indexed array
// Now return the node objects.
$nodes = node_load_multiple($nids);