ILYAS415 Posted February 23, 2008 Share Posted February 23, 2008 Okay when i run my script i get a serious error. The page tells me that... Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/username/public_html/game/index.php on line 23 Heres my query at line 22 and my function at line 23... $user= mysql_query("SELECT * FROM `users` WHERE `username`='$username' AND `password`='$password'"); $usernum= mysql_num_rows($user); The query works for me on the database when i run it but not on this script. For a test of this script go to... THIS URL I would appreciate it alot if anyone can help. Note: Ive checked my database and all the columns and tables im looking for are valid and exist. Link to comment https://forums.phpfreaks.com/topic/92610-mysql_num_rows-error/ Share on other sites More sharing options...
Bauer418 Posted February 23, 2008 Share Posted February 23, 2008 Change this line: $user= mysql_query("SELECT * FROM `users` WHERE `username`='$username' AND `password`='$password'"); To this: $user= mysql_query("SELECT * FROM `users` WHERE `username`='$username' AND `password`='$password'") or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/92610-mysql_num_rows-error/#findComment-474623 Share on other sites More sharing options...
ILYAS415 Posted February 23, 2008 Author Share Posted February 23, 2008 Hey thanks! Okay its telling me htat no database is selected so ill fix that. Thanks again. Link to comment https://forums.phpfreaks.com/topic/92610-mysql_num_rows-error/#findComment-474624 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.