可能重复:
mysql_fetch_array() expects parameter 1 to be resource, boolean given in select
代码 -
$q="SELECT * FROM tbl_quevote WHERE que_id = '".$qid."' and voteby='".$uid."'";
$result = $mysqli->query($q) or die(mysqli_error($mysqli));
$num_rows = mysql_num_rows($result);
echo $num_rows;
错误:
警告:mysql_num_rows()要求参数1为资源,第13行的C:\ xampp \ htdocs \ shizin \ voting.php中给出的对象
how to check result is empty?
答案 0 :(得分:32)
$num_rows = $result->num_rows;
答案 1 :(得分:2)
int mysql_num_rows ( resource $result )
从结果集中检索行数。此命令仅对返回实际结果集的SELECT
或SHOW
等语句有效。要检索受INSERT, UPDATE, REPLACE or DELETE
查询影响的行数,请使用mysql_affected_rows()
。