[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
Re: [PHP] Problem with MySQL Query
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 [EMAIL PROTECTED] To: PHP List [EMAIL PROTECTED] 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
Re: [PHP] Problem with MySQL Query
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 [EMAIL PROTECTED] To: PHP List [EMAIL PROTECTED] 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with MySQL Query
Hello, This is a reply to an e-mail that you wrote on Wed, 23 Jul 2003 at 22:28, lines prefixed by '' were originally written by you. 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. Try $dbqueryshipping1 = select * from tempuserpurchase where (usersessionid=\$User_Shopping_Id\) and day=\1\ and type'Meal Plans' David -- phpmachine :: The quick and easy to use service providing you with professionally developed PHP scripts :: http://www.phpmachine.com/ Professional Web Development by David Nicholson http://www.djnicholson.com/ QuizSender.com - How well do your friends actually know you? http://www.quizsender.com/ (developed entirely in PHP) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with MySQL Query
$dbqueryshipping1 = select * from tempuserpurchase where (usersessionid=\$User_Shopping_Id\) and day=\1\ and type'Meal Plans' Tryed both methods and it is still not excluding anything matching Meal Plans --- 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
Re: [PHP] Problem with MySQL Query
$dbqueryshipping1 = select * from tempuserpurchase where (usersessionid=\$User_Shopping_Id\) and day=\1\ and type'Meal Plans' Tryed both methods and it is still not excluding anything matching Meal Plans Been a short while since I used SQL with my PHP, but try putting NOT instead of . -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with MySQL Query
Hello, This is a reply to an e-mail that you wrote on Wed, 23 Jul 2003 at 22:54, lines prefixed by '' were originally written by you. $dbqueryshipping1 = select * from tempuserpurchase where (usersessionid=$User_Shopping_Id) and day=1 and type'Meal Plans' Tryed both methods and it is still not excluding anything matching Meal Plans Is the data you are wanting to exclude exactly 'Meal Plans' (case sensitive). If not, use: type NOT LIKE 'Meal Plans' David. -- phpmachine :: The quick and easy to use service providing you with professionally developed PHP scripts :: http://www.phpmachine.com/ Professional Web Development by David Nicholson http://www.djnicholson.com/ QuizSender.com - How well do your friends actually know you? http://www.quizsender.com/ (developed entirely in PHP) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with MySQL Query
Tried NOT LIKE and that didnt exclude it either. I am trying to exclude only 'Meal Plans' Phil - Original Message - From: David Nicholson [EMAIL PROTECTED] To: Phillip Blancher [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 6:19 PM Subject: Re: [PHP] Problem with MySQL Query Hello, This is a reply to an e-mail that you wrote on Wed, 23 Jul 2003 at 22:54, lines prefixed by '' were originally written by you. $dbqueryshipping1 = select * from tempuserpurchase where (usersessionid=$User_Shopping_Id) and day=1 and type'Meal Plans' Tryed both methods and it is still not excluding anything matching Meal Plans Is the data you are wanting to exclude exactly 'Meal Plans' (case sensitive). If not, use: type NOT LIKE 'Meal Plans' David. -- phpmachine :: The quick and easy to use service providing you with professionally developed PHP scripts :: http://www.phpmachine.com/ Professional Web Development by David Nicholson http://www.djnicholson.com/ QuizSender.com - How well do your friends actually know you? http://www.quizsender.com/ (developed entirely in 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Problem with MySQL Query
Why are you using NOT LIKE for? NOT LIKE is used when you are doing a part search Try this.. $dbqueryshipping1 = select * from tempuserpurchase where usersessionid = \$User_Shopping_Id\ day = \1\ type != \Meal Plans\; also from your original query you are closing off the line at day= which could be a reason for it not completing Hope this helps -- Chris Kay (CK) Eleet Internet Services P: 0415 451 372 F: 02 4620 5076 E: [EMAIL PROTECTED] -Original Message- From: Phillip Blancher [mailto:[EMAIL PROTECTED] Sent: Thursday, 24 July 2003 8:24 AM To: David Nicholson Cc: PHP List Subject: Re: [PHP] Problem with MySQL Query Tried NOT LIKE and that didnt exclude it either. I am trying to exclude only 'Meal Plans' Phil - Original Message - From: David Nicholson [EMAIL PROTECTED] To: Phillip Blancher [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, July 23, 2003 6:19 PM Subject: Re: [PHP] Problem with MySQL Query Hello, This is a reply to an e-mail that you wrote on Wed, 23 Jul 2003 at 22:54, lines prefixed by '' were originally written by you. $dbqueryshipping1 = select * from tempuserpurchase where (usersessionid=$User_Shopping_Id) and day=1 and type'Meal Plans' Tryed both methods and it is still not excluding anything matching Meal Plans Is the data you are wanting to exclude exactly 'Meal Plans' (case sensitive). If not, use: type NOT LIKE 'Meal Plans' David. -- phpmachine :: The quick and easy to use service providing you with professionally developed PHP scripts :: http://www.phpmachine.com/ Professional Web Development by David Nicholson http://www.djnicholson.com/ QuizSender.com - How well do your friends actually know you? http://www.quizsender.com/ (developed entirely in 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php