Notice: Trying to get property of non-object in my_module_get_nodequeue_id_by_name() (line 30 of my_module/my_module.module) /**
 * Gets the nodequeue id by nodequeue name
 */
function my_module_get_nodequeue_id_by_name($name) {
  $data = db_query('SELECT qid FROM {nodequeue_queue} WHERE title = :title', array(':title' =&gt; $name))-&gt;fetchField();
  return $data-&gt;qid;
}


The above code produced this kind of notice:

Notice: Trying to get property of non-object in my_module_get_nodequeue_id_by_name() (line 30 of my_module/my_module.module).
fetchField() returns a single value, not an object. You either want to use fetchField() like this:

$qid = db_query('SELECT qid FROM {nodequeue_queue} WHERE title = :title', array(':title' =&gt; $name))-&gt;fetchField();
return $qid;


or use fetchObject() instead:

$data = db_query('SELECT qid FROM {nodequeue_queue} WHERE title = :title', array(':title' =&gt; $name))-&gt;fetchObject();
return $data-&gt;qid;