Re: MySQL error checking/matching

From: Date: Sun, 17 Feb 2002 15:24:05 +0000
Subject: Re: MySQL error checking/matching
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-85106@lists.php.net to get a copy of this message
----- Original Message ----- From: "Navid Yar" <superbus22@attbi.com> > $query = "select email from customers" // Check for duplicate > entry > . "where email = $email"; > $query = stripslashes($query); > $result = mysql_query($query); > > $num_results = mysql_num_rows($result); // Get the number of > rows in database (integer) > And this produces the following error: > Warning: Supplied argument is not a valid MySQL result resource in > e:\localhost/book-o-rama/admin/signup_do.php on line 34. > > What am I doing wrong? Any help would be appreciated... You are not checking to see if the mysql_query completed successfully. What you could do is: $result = mysql_query($query) or die(mysql_error()); http://www.php-faq.com/faq.php#10

« previous php.general (#85106) next »