Page 1 of 1

Catchable fatal error - not sure why!

Posted: Tue Jul 06, 2010 9:40 am
by mikeman
Hi,

Any ideas why I am getting this error:
Catchable fatal error: Object of class mysqli_result could not be converted to string in ....

Code: Select all

$sql = "SELECT id FROM activity ORDER BY id DESC LIMIT 1";
$lastresult = mysqli_query($dbc, $sql) or die ("Could not perform query");

echo $lastresult;
The SQL runs ok in phpmyadmin and the table is populated.
Cheers.

Re: Catchable fatal error - not sure why!

Posted: Tue Jul 06, 2010 9:43 am
by AbraCadaver
Because that function returns a result object from which you need to fetch rows. Try looking at the manual and/or a tutorial for PHP and mysql.