i have the following query:
$timecheck = $db->query("SELECT (B <= NOW()) AS var FROM table1 WHERE x='$x'");
while ($row = $db->fetch_object()){
if ($row->var != 0){
$updatestatus = $db->query("UPDATE table2 SET abc='1' WHERE x='$x'");
}
}
and get the following errormessage:
Fatal error: Call to undefined method mysqli::fetch_object()
that relates to this line:
while ($row = $db->fetch_object()){
i also was trying to use:
while ($row = $db->fetch_object($timecheck)){
without any success. So in the manual is nothing written about how to use an alias by fetch-method.
it would be great if there is someone who could tell me what am i doing wrong. thanks a lot.
Try this
Mysqli::querydoes not havefetch_objectmethod it would returnmysqli_result::fetch_assocfor more information please look athttp://www.php.net/manual/en/mysqli.query.php
http://php.net/manual/en/mysqli-result.fetch-assoc.php
http://www.php.net/manual/en/mysqli-result.fetch-object.php
Example :
Thanks
🙂