mysql_query() problem
| From: | Brian Rue | Date: | Mon, 17 Dec 2001 08:33:15 +0000 |
| Subject: | mysql_query() problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-77893@lists.php.net to get a copy of this message | ||
Hi,
I'm getting the error
<<Warning: Supplied argument is not a valid MySQL result resource>>
from this code:
function validateUser($username,$password) {
$conn = connectToMySQL();
mysql_select_db($db_name,$conn);
$query="select * from members where username='".$username."' AND
password='".$password."'";
$result = mysql_query($query,$conn);
if (mysql_num_rows($result) != 0) { //*this is the line that returns the
error*
return true;
} else {
return false;
}
}
I've checked that the connection works, and that the query is what it should
be, and the query works when I type it into the terminal. Any ideas?
Thanks,
Brian Rue