Re: i am lost (php warning)
| From: | graeme | Date: | Tue, 18 Jan 2005 07:58:27 +0000 |
| Subject: | Re: i am lost (php warning) | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-38193@lists.php.net to get a copy of this message | ||
The mysql_num_rows function requires that the argument passed to it should be a valid MySQL result from a Select statement. Your script doesn't explicitly establish a connection with the database so you could be getting an error from that call, hence $sql_query would not be a valid MySQL result. Try adding the following:
if (!$sql_query) {
die('Invalid query: ' . mysql_error());
}
graeme
Earl Clare wrote:
Hi ya'll, I am lost as to why I am getting this error in my script. Can anyone kindly explain why this is so. Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/cm/public_html/cell/login.php ---------------------------------------------------------------------------- ----- Experience is a good teacher, but she sends in terrific bills. Minna AntrimMy script---------------------------------------------------------------------------- --- if($_POST['submit'] == '>Log In') {$user=$_POST["email"];$pass=$_POST["pass"];$sql_query = mysql_query("SELECT * FROM cm_customer WHEREemial='$user'");$sql_query = mysql_num_rows($sql_query);if (($sql_query) >0){$valid = $user;session_start();session_register("valid");} } if (session_is_registered("reg")) {echo "ok";} else {echo "sorry";}