note 50694 added to function.mysql-num-rows

From: Date: Mon, 07 Mar 2005 16:26:34 +0000
Subject: note 50694 added to function.mysql-num-rows
Groups: php.notes 
Request: Send a blank email to php-notes+get-86051@lists.php.net to get a copy of this message
Is there some limit to the number of times you can use sql_num_rows, or is there some way you need to reset this value between sql statements? I seem to be able to use it once, but when I try to use it again on another table using exactly the same syntax, it fails. //Total User Count $countusers = "SELECT * FROM Users"; $users = mysql_query($countusers); $count_users = mysql_num_rows($users); //Total Survey Count $countsurveys = "SELECT * FROM Survey1"; $surveys = mysql_query($countsurveys); $count_surveys = mysql_num_rows($surveys); The first one runs OK and returns the correct result, but the next one (and all subsequent ones) returns the following: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource ---- Manual Page -- http://www.php.net/manual/en/function.mysql-num-rows.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+50694 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50694&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50694&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50694&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50694&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50694&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+50694&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#86051) next »