Database query to check if current user has created a node reference?
Took a while to spot this, but you're not selecting any fields in the query so the SQL syntax here SELECT FROM {node} n is invalid.

Just select a field and you should be fine:

$query = db_select('node', 'n')
  -&gt;fields('n', array('nid'))
  -&gt;condition('type', 'b', '=')
  -&gt;condition('uid', $user-&gt;uid, '=');