在查询正确时在非对象上获取fetch_assoc()

时间:2014-10-26 16:27:22

标签: php mysql

我收到fetch_assoc() on a non-object错误,我确实回应了查询,并在PHPMyAdmin中运行它。它会返回1个结果。但是当我尝试使用fetch_assoc()时,我仍然会收到错误。

$autoquery = "SELECT 
               Year,Vozila, Marke_vozila, Model_vozila, bodywork, doors, fuel, gear_box, Tip_vozila, izvedba_vozila, hide 
             FROM vozila_tbl
             WHERE 
               Year = 2008 AND Marke_vozila = 'Iveco' AND Model_vozila = 'Daily' AND Tip_vozila = '29 L 10V 300 H2 | 5-vrata MPV 70 kw (06/06 - 10/11' AND Vozila='Auto' 
             GROUP BY izvedba_vozila 
             ORDER BY izvedba_vozila DESC";

$autoresult = $mysqli->query($autoquery);
$array[0][] = "Birajte ".$option;

//Database values
while($row = $autoresult->fetch_assoc()){ //This is the line it says fetch_assoc() is a non-object
    $array[1][] = $row[$value];
}

$array[1] = print_r($mysqli->error);

return $array;

0 个答案:

没有答案