1 batch_example.module batch_example_lowest_nid()

Utility function - simply queries and loads the lowest nid.

Return value

int|NULL: A nid or NULL if there are no nodes.

Related topics

File

modules/examples/batch_example/batch_example.module, line 290
Hook implementations for the Batch Example module.

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;
}