I am trying to get information from two database tables in the same database query using the following code:
$query = db_select('webform_questionnaire_fieldset', 'wqf'); $query->join('webform_component', 'wc', 'wqf.cid = wc.cid'); $query->fields('wqf') ->fields('wc') ->condition('wqf.cid', $cid, '=') ->condition('wqf.nid', $nid, '=') ->condition('wqf.cid', 'wc.cid', '=') ->execute() ->fetchAll();
The output I get is not like database data, but more like database metadata as follows:
SelectQuery::__set_state(array( 'fields' => array ( ), 'expressions' => array ( ), 'tables' => array ( 'wqf' => array ( 'join type' => NULL, 'table' => 'webform_questionnaire_fieldset', 'alias' => 'wqf', 'condition' => NULL, 'arguments' => array ( ), 'all_fields' => true, ), 'wc' => array ( 'join type' => 'INNER', 'table' => 'webform_component', 'alias' => 'wc', 'condition' => NULL, 'arguments' => array ( ), 'all_fields' => true, ), ), 'order' => array ( ), ......
Can someone tell me what I'm doing wrong?