Hi
Try the following to find out what's happening :
$result = mysql_query($query,$conn) or die (mysql_error());
Or try echo'ing $result to see what it contains. It should contain something
like this if everything is working fine :
Resource id #2
Regards
Girish
----- Original Message -----
From: "Brian Rue" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, December 17, 2001 8:33 AM
Subject: [PHP] mysql_query() problem
> 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) { file://*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
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]