I am making a search condition where i see if the $result=mysqli_query($dbconnect,$someQuery);
if($result==false)
orif($result==null)
but it doesn't respond to a boolean as a compared value. although if the condition is satisfied, the if($result==true)
condition is called.
this is my query
$someQuery="select * from books where bookid = '$id'";
what condition checks if the mysql query failed or returned nothing?
Like @Avinash Babu sait mysql_query allways return false if there is something wrong with the query....I would suggest you try to check if the query was successfully or not like this:
mysql_query()
returns false always if there is any query error.For a successful queries it wont return false..The return value will be true and if the row is not empty it will return themysqli_result()
object.Please have a look here.It might help more ..:)
Please search for it on google, this should help you http://php.net/manual/en/mysqli.query.php by the way, mysqli_query returns FALSE if the statement fails, or a mysqli_result object which can used to associate arrays or other stuff
reference: http://php.net/manual/en/mysqli.query.php as written before