batch_example_lowest_nid

7 batch_example.module batch_example_lowest_nid()
8 batch_example.module batch_example_lowest_nid()

Utility function - simply queries and loads the lowest nid.

Return value

A nid or NULL if there are no nodes.

Related topics

2 calls to batch_example_lowest_nid()

File

batch_example/batch_example.module, line 240
Outlines how a module can use the Batch API.

Code

function batch_example_lowest_nid() {
  $select = db_select('node', 'n')
  ->fields('n', array('nid'))
  ->orderBy('n.nid', 'ASC')
  ->extend('PagerDefault')
  ->limit(1);
  $nid = $select->execute()->fetchField();
  return $nid;
}
Login or register to post comments