mysql_query and SELECT syntax (Using php4, mysql, apache on WIndows XP home)

From: Date: Wed, 07 Aug 2002 14:03:19 +0000
Subject: mysql_query and SELECT syntax (Using php4, mysql, apache on WIndows XP home)
Groups: php.windows 
Request: Send a blank email to php-windows+get-15151@lists.php.net to get a copy of this message
I want to SELECT a field from a table but only if it meets TWO criteria and then assign it to $result. I can get this code (only requiring one criteria) to work: After connecting to my database... Partial code in a function: $query = "SELECT username FROM $user_tablename WHERE userid = '$userid'"; $result = mysql_query($query); if (!mysql_num_rows($result)) return 0; else { $query_data = mysql_fetch_row($result); return $query_data[0]; } But when I try to add another crtiteria... WHERE userid = "$userid' AND userpassword = password('$userpassword')"; I get an error about mysql_num_rows() supplied argument is not a valid MySQL result resource. Can anyone help?

« previous php.windows (#15151) next »