I'm updating a lot of old methods, but I've got stuck with this line
$res =& $mdb2->query($mdb2->prepare("SELECT * FROM book WHERE id = ?"), array($sql_id));
I was getting a message in the error log saying PHP Fatal error: Call to undefined method MDB2_Error::numRows()
So I added this line
if (PEAR::isError($res)) { die($res->getMessage().' ::: '.$res->getUserInfo()); }
to see what was causing the error and I get this back to the screen
MDB2 Error: syntax error ::: _doQuery: [Error message: Could not execute statement] [Last executed query: MDB2 Error: syntax error] [Native code: 1064] [Native message: 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 'MDB2 Error: syntax error' at line 1]
I'm not sure what's wrong with the query, it looks ok to me?
here it is , no need to do the PREPARE part.
$res =& $mdb2->query("SELECT * FROM book WHERE id = '" . $sql_id . "' " );