not a valid MySQL result resource [was: I'm new and need quick help]
Hiya, I was wondering if anybody can help.
I have a website which i have a login script for however I want to users to be able to have an account balance. I have set up a field for balance in the users table of my database however I am having problems fetching the correct row for each user.
This is my code:
$mysqlLink = mysql_connect( 'mysql2.freehostia.com' , 'My Username', 'My Password' );
mysql_select_db( 'joesha1_members' , $mysqlLink );
$result = mysql_query("SELECT * FROM `users` WHERE `username`= ".$_SESSION['username']." AND `password`=".$_SESSION['password']." ");
while( $row = mysql_fetch_array($result) )
echo $row[ 'username' ] . $row[ 'balance' ];
mysql_close( $mysqlLink );
It keeps on displaying this error
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/www/joesha1.freehostia.com/account.php on line 19
Thanks and hope i made any sence, Joe
Last edited by guelphdad; 11-09-2006 at 12:17 AM..
Reason: provide decent thread title