My table reservation is formed of the following fields: hour ,minute,day,month,name,table,rnumber
When I execute the query as follows:
$query = "select * from reservation";
$result = $db->query($query);
$row = $result->fetch_assoc();
It works perfectly.
However when I change the query to be
$query = "select * from reservation where table like '%1%'";
I get a blank result and the following error in apache log:
Mon Aug 08 20:17:19 2011] [error] [client ::1] PHP Fatal error: Call to a member function fetch_assoc() on a non-object in /srv/http/reservation.php on line 43, referer: http://localhost/
And if I change it to the following:
$query = "select * from reservation where 'table'=1";
I get 0 as result. (table is INT)
A second question is, am I using up to date syntax? I've seen most people use mysql_query().