php mysqli_query 问题

An error occurred in script 'E:\www\ecommerce\product.php' on line 30:
mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given
Date/Time:12-18-2010 14:54:22

源码:
$q="SELECT sw_id,color,size,price,in_stock FROM specific_widgets LEFT JOIN colors USING(color_id) LEFT JOIN sizes USING(size_id) WHERE gw_id=$gw_id ORDER BY size,color";
$r=mysqli_query($dbc,$q);
if (mysqli_num_rows($r) >= 1)

第1个回答  2010-12-18
用var_dump检查一下你的$r。
mysqli_query()中执行SELECT语句会返回结果对象,但是如果失败就会返回false,根据你的错误提示,$r返回的是真假值。
检查一下你的SQL语句吧。
相似回答