[PHP] mySQL query grief
Hi all, newbie to MySQL... I get this error: Supplied argument is not a valid MySQL result resource in /usr/local/ blah blah blah From this query: $username = juddy2; $sql = SELECT * FROM staff WHERE id=.$username; $result = mysql_query($sql); However, this works okay: $username = juddy2; $sql = SELECT * FROM staff; $result = mysql_query($sql); So, I guess my WHERE... stuff is wrong. I just want to retrieve the whole row of information relating to a certain user (eg juddy2). The usernames are unique in the table, contained in a column called id. Many Thanks in advance Justin French -- 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]
Re: [PHP] mySQL query grief
Justin - there's an error in your query. I think it should be: $sql = SELECT * FROM staff WHERE id='$username'; Anyway, to see which is the problem just ? print mysql_error(); ? after $result = mysql_query($sql); HTH Gianluca JF newbie to MySQL... JF I get this error: JF Supplied argument is not a valid MySQL result resource in /usr/local/ JF blah blah blah JF From this query: JF $username = juddy2; JF $sql = SELECT * FROM staff WHERE id=.$username; JF $result = mysql_query($sql); JF However, this works okay: JF $username = juddy2; JF $sql = SELECT * FROM staff; JF $result = mysql_query($sql); JF So, I guess my WHERE... stuff is wrong. I just want to retrieve the JF whole row of information relating to a certain user (eg juddy2). The JF usernames are unique in the table, contained in a column called id. JF Many Thanks in advance JF Justin French -- ALBASOFTWARE C/ Mallorca 186 - 3º 1ª 08036 Barcelona (Spain) Tel. +34 93454009 - +34 934549324 Fax. +34 934541979 @@ ICQ 47323154 @@ [EMAIL PROTECTED] http://www.albasoftware.com http://www.phpauction.org http://www.gianlucabaldo.com -- 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]