Re: mySQL query grief

From: Date: Sun, 22 Jul 2001 11:25:21 +0000
Subject: Re: mySQL query grief
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-59054@lists.php.net to get a copy of this message
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 @@ webmaster@albasoftware.com http://www.albasoftware.com http://www.phpauction.org http://www.gianlucabaldo.com

« previous php.general (#59054) next »