Call to a member function fetch_assoc() on a non-object
I'm new here and equally new to PHP and MySQL. I'm getting the following error in a forum script when a member tried to send a message:
You have an error in your query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 't get things to work and have rescheduled today. She doesn't know this but this' at line 1
Query: select count(id) as num from mb_messages where (message='Member message here') and (mid='22')
Fatal error: Call to a member function fetch_assoc() on a non-object in /home/fastingo/public_html/fastingologyfitnessthroughfasting/incs/sys/db.extend.class.php on line 6
The relevant code of the db.extend.class.php file (Top 15 lines) is shown below:
<?php function DB_count_messages(&$DBobj, $extra='') { $query="select count(id) as num from mb_messages $extra"; $DBobj->res=$DBobj->query($query); $row=$DBobj->res->fetch_assoc(); return $row["num"]; }
Bhupinder
Eddie Spradley