I'm trying to add a field to my query by using addField(). However, whenever I add this to the query I get a whitescreen and an apache error message on the line after. Any help in resolving this would be much appreciated.
Apache error log:
PHP Fatal error: Call to a member function extend() on a non-object
$query = db_select('z_revision', 't') ->fields('t', array('drupal_user_id')) ->addField('t', 'z', 'category') ->extend('PagerDefault') # error on this line ->extend('TableSort')->orderByHeader($header) ->limit(30) ->execute();
Ideally this would give me a two column table with headers 'drupal_user_id' and 'category' - all the rows in the category column having 'z' as a value.