php - Catchable fatal error: Argument 1 passed to ... must be an instance of ..., boolean given, called in ... on line ... and defined in ... on line -
i have added cms server. wondering why keep getting error on page purchase subscription.
this error;
catchable fatal error: argument 1 passed objectarray::frommysqliresult() must instance of mysqli_result, boolean given, called in c:\inetpub\wwwroot\model\factoryobjects\user.php on line 71 , defined in c:\inetpub\wwwroot\lib\objectarray.php on line 284
line 71 has following;
public function getorders() { $objectarray = new objectarray(); $result = $this->getconnection()->query("select * vip_orders user_id = '" . $this->id. "'"); $objectarray->frommysqliresult($result); (<line 71<) return $objectarray; }
line 284 has following;
public function frommysqliresult(mysqli_result $result) (<line 284<) { $this->clear(); while ($row = $result->fetch_object()) { $this->add($row); } return $this; }
please let me know if other information necessary me fix error!
thanks!
(note: assisting, please explain problem? example, function , why not working, thank you.)
your definition of frommysqliresult(mysqli_result $result)
states function requires parameter of type mysqli_result
. however, passing result of mysqli::query() might of type boolean in case of failure.
to prevent error, make sure $result
query result similar example in documentation:
if ($result) { $objectarray->frommysqliresult($result); } else { // handle error }
Comments
Post a Comment