RE: [PHP-DB] Select where

From: Date: Tue, 20 Mar 2001 16:48:29 +0000
Subject: RE: [PHP-DB] Select where
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-7656@lists.php.net to get a copy of this message
Tim, Your missing a double quotation prior to your SELECT. Further, are you connected to a database? : $result=mysql_query($sql,$db); Chris > -----Original Message----- > From: boclair [mailto:boclair@bigpond.net.au] > Sent: 20 March 2001 14:54 > To: php-db@lists.php.net > Subject: Re: [PHP-DB] Select where > > > > ----- Original Message ----- > From: boclair <boclair@bigpond.net.au> > To: <php-db@lists.php.net> > Sent: Wednesday, March 21, 2001 12:02 AM > Subject: [PHP-DB] Select where > > > > This is simple but I cannot see where I am going wrong > > > > I have a table members with one of the fields > > status, varchar(10) > > > > The values may be active or retired or deceased or null > > > > If I run the select > > > > SELECT * FROM members WHERE status = 'deceased'; > > > > I get MySQL said: You have an error in your SQL syntax near > > '\'deceased\';' at line 1 > > > > Will somebody show me the correct syntax > > _______________________ > > > $query = "SELECT * FROM members where status='deceased'" > > > > Then just call the $query in your script > _______________________________ > > Thanks, I only gave the mySQL but the php scripting is > > > $deceased = mysql_query(SELECT * FROM members where > status=\'deceased\'"); > and later > while ($myrow = mysql_fetch_row($deceased)) > > MySQL now says in relation to the *while* line > Warning: Supplied argument is not a valid MySQL result resource > > Tim Morris > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.db (#7656) next »