13
$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; 

Error:

Warning: mysql_num_rows() expects parameter 1 to be resource, object given in C:\xampp\htdocs\shizin\voting.php on line 13

How to check result is empty?

0

2 Answers 2

34
$num_rows = $result->num_rows; 
Sign up to request clarification or add additional context in comments.

1 Comment

+1 - For the right answer, but it helps to give more info. php.net/manual/en/mysqli-stmt.num-rows.php, as num_rows is part of the mysqli extension and mysql_num_rows is part of a different extension.
2

int mysql_num_rows ( resource $result ) Retrieves the number of rows from a result set. This command is only valid for statements like SELECT or SHOW that return an actual result set. To retrieve the number of rows affected by a INSERT, UPDATE, REPLACE or DELETE query, use mysql_affected_rows().

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.