Re: Problem with MySQL Query

From: Date: Wed, 23 Jul 2003 21:27:03 +0000
Subject: Re: Problem with MySQL Query
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-156539@lists.php.net to get a copy of this message
As per your suggestion $dbqueryshipping1 = "select * from tempuserpurchase where (usersessionid=\"$User_Shopping_Id\") and day=\"1\" and type!='Meal Plans' "; $resultshipping1 = mysql_db_query($dbname,$dbqueryshipping1); if(mysql_error()!=""){echo mysql_error();} $result1 = mysql_num_rows($resultshipping1); It is still not excluding "Meal Plans" from the listing. > Take out the plus sign... type != 'Meal Plans' > > And using single quotes in your query might make things easier (no > escaping...) > > $dbqueryshipping1 = "select * from tempuserpurchase where > usersessionid='$User_Shopping_Id' and day='1' and type!='Meal > Plans'"; > > You don't need quotes around '1' since it's an integer, but MySQL is > forgiving. > > ---John Holmes... > > ----- Original Message ----- > From: "Phillip Blancher" <phil@ontarioweb.ca> > To: "PHP List" <php-general@lists.php.net> > Sent: Wednesday, July 23, 2003 5:08 PM > Subject: [PHP] Problem with MySQL Query > > > Problem with mySQL Query > This is the query I have: > > $dbqueryshipping1 = "select * from tempuserpurchase where > (usersessionid=\"$User_Shopping_Id\") and day=\"1\" and type!=\"Meal+Plans\" > "; > > What I want to do is to select everything from tempuserpurchase that matchs > the user session and the day, so long as type is not "Meal Plans" > > However it is not excluding "Meal Plans" > > Any Suggestions. > > Thanks in advance, > > Phil > > > __________________ > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.501 / Virus Database: 299 - Release Date: 7/14/2003 > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- > This message has been scanned for viruses and > dangerous content by Ontario Webs MailScanner, and is > believed to be clean. > > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.501 / Virus Database: 299 - Release Date: 7/14/2003

« previous php.general (#156539) next »