Select data from database when submitting a form
You have missed fields() &amp; fetch type -- fetchAll().

Below is the working example. You can find more details here (db_select API) 

$query = db_select('node', 'n')-&gt;extend('PagerDefault');
$query-&gt;fields('n'); // This is like select *. You can retrieve specific fields too.
$query-&gt;condition('type', 'article');
$result = $query-&gt;execute()-&gt;fetchAll(); // you can fetch by object, array, etc...
print_r($result);