Приветствую, Уважаемые!
Пытаюсь сделать запрос,
public function getItemsFromDB(){
$respArr = array();
for($i = 3; $i < 17; $i++){
if(!$this->selectedCategories || in_array($i, $this->selectedCategories)){
$paramJoins = $this->getParamJoins($i);
$queryString = 'SELECT o.id, o.name, o.text2, addr.value as addr, square.value as square, city.value as city, region.value as region, price.value as price, street.value as street, house.value as house, r1.id as category_id, '.$paramJoins['select'].' r1.parent_id, GROUP_CONCAT(i.`big` ORDER BY i.ord ) AS photos FROM realty_objects o LEFT JOIN realty r ON r.id=o.parent_id LEFT JOIN realty r1 ON r1.id=r.parent_id LEFT JOIN images i ON (i.record_id=o.id AND i.model IS NOT NULL) LEFT JOIN param_values price ON (price.record_id = o.id AND price.param_id='.($i < 10 ? 24 : 40).') '.$paramJoins['joins'].' WHERE o.`on`= 1 AND o.lng_id=1 AND r1.id = '.$i.' '.($this->excludeIdsString ? $this->excludeIdsString : '').' GROUP BY o.id';
$queryStringProjects = 'SELECT o.id, o.name, o.text2, addr.value as addr, square.value as square, city.value as city, region.value as region, price.value as price, street.value as street, house.value as house, r2.id as category_id, '.$paramJoins['select'].' r2.parent_id, GROUP_CONCAT(i.`big` ORDER BY i.ord ) AS photos FROM realty o LEFT JOIN realty r2 ON r2.id=o.parent_id LEFT JOIN images i ON (i.record_id=o.id AND i.model IS NOT NULL) LEFT JOIN param_values price ON (price.record_id = o.id AND price.param_id='.($i < 10 ? 24 : 40).') '.$paramJoins['joins'].' WHERE o.`on`= 1 AND o.lng_id=1 AND r2.id = '.$i.' '.($this->excludeIdsString ? $this->excludeIdsString : '').' GROUP BY o.id';
$resp = $this->query->query($queryString);
$respProjects = $this->query->query($queryStringProjects);
while($item = $resp->fetch_assoc()){
if(!$this->selectedIds || in_array($item['id'], $this->selectedIds)){
$respArr[] = $item;
}
}
while($item = $respProjects->fetch_assoc()){
if(!$this->selectedIds || in_array($item['id'], $this->selectedIds)){
$respArr[] = $item;
}
}
}
}
return $respArr;
}
но вылетает с ошибкой.
Call to a member function query() on a non-object
в строке
$resp = $this->query->query($queryString);
Собранные вручную запросы $queryString и $queryStringProjects напрямую в phpMyadmin отрабатывают без ошибок.