我正在搜索条件,查看是否$result=mysqli_query($dbconnect,$someQuery);
if($result==false)或if($result==null),但是它不响应布尔值作为比较值.尽管如果满足条件,则会调用if($result==true)条件.
这是我的查询
$someQuery="select * from books where bookid = '$id'";什么条件检查mysql查询是否失败或什么都不返回?
解决方案mysql_query()如果存在任何查询错误,则始终返回false.对于成功的查询,它不会返回false.不为空,它将返回mysqli_result()对象.
请此处. /p>
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?
解决方案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 the mysqli_result() object.
Please have a look here.It might help more ..:)
更多推荐
如果查询为空,mysqli
发布评论