Jump to content


Photo

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/essexrac/public_html/joe/projectx/login.php on line 33


  • Please log in to reply
3 replies to this topic

#1 joecooper

joecooper
  • Members
  • PipPipPip
  • Advanced Member
  • 358 posts

Posted 10 March 2006 - 04:03 PM

cannot understand why it gives that error!. other pages with that code works fine.

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/essexrac/public_html/joe/projectx/login.php on line 33


$sql="SELECT * FROM users WHERE username='$username' AND password='$password'"; //get rows where the username feild matches the username or email feild in the database with same password
$result=mysql_query($sql);
//if there was a row returned, then obiously there is an account with the correct username/password. They may login!
if (mysql_num_rows($result) == 1){
$_SESSION['loggedin']="TRUE"; //set the global session varible for loggedin to true
die("Welcome $username! You are now logged in");
}
Signature:
[/a]
[a href="http://www.planet-so...=1999&lngWId=8" target="_blank"]EzLogin 1.0[/a]
[a href="http://www.essexracers.com" target="_blank"]Essexracers.com[/a]
Msn Messenger: joe@joeyjoe.co.uk

#2 craygo

craygo
  • Staff Alumni
  • Advanced Member
  • 1,973 posts
  • LocationRhode Island

Posted 10 March 2006 - 04:12 PM

That usually means there is a problem with your select statement and error return to see.

change this
$result=mysql_query($sql);

to this
$result = mysql_query($sql) or die (mysql_error());

Then post error

Ray

#3 joecooper

joecooper
  • Members
  • PipPipPip
  • Advanced Member
  • 358 posts

Posted 10 March 2006 - 04:22 PM

oops, missed out the db include!
cheers
Signature:
[/a]
[a href="http://www.planet-so...=1999&lngWId=8" target="_blank"]EzLogin 1.0[/a]
[a href="http://www.essexracers.com" target="_blank"]Essexracers.com[/a]
Msn Messenger: joe@joeyjoe.co.uk

#4 craygo

craygo
  • Staff Alumni
  • Advanced Member
  • 1,973 posts
  • LocationRhode Island

Posted 10 March 2006 - 04:24 PM

Cool deal
Always something stupid, After looking at your code long enough everything starts to get jumbled together.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users