Displaying SQL-table as a paginated list
The call to db_select() and the following calls to methods are wrong.


The second parameter of db_select() is a table alias, which should then used when referring to the fields used by the query.
the parameters passed to the fields() is wrong; see the following snippet for an example of how the call to db_select() should be.



$result = db_select('file_usage', 'f')
   ->fields('f', array('module', 'type', 'id', 'count'))
   ->condition('fid', $file->fid)
   ->condition('count', 0, '>')
   ->execute();


Your call to db_select() should be re-written as:

$query = db_select('users', 'u')
  -&gt;fields('u', array('name', 'uid'))
  -&gt;orderBy('created', 'DESC')
  -&gt;limit(20)
  -&gt;extend('PagerDefault');