RE: [PHP] MySQL/PHP problem.

From: Date: Tue, 22 Jul 2003 23:20:52 +0000
Subject: RE: [PHP] MySQL/PHP problem.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-156359@lists.php.net to get a copy of this message
Off the top of my head, try using OR in your query rather than AND day=\"2\" or day=\"3\" day probably won't equal both 2 and 3, which is why you are getting 0. Also, if you group by item name, you are going to get the total for each itemname, is that what you want, or just the overall total? > -----Original Message----- > From: Phillip Blancher [mailto:phil@ontarioweb.ca] > Sent: Tuesday, July 22, 2003 2:09 PM > To: PHP List > Subject: [PHP] MySQL/PHP problem. > > > I am trying to count in mySQL the number of entries in the field > "day" where day=2 or 3. > > Then I want to check just to see if that returned a value greater > than 0 or not. > > I am using the code below, but having a problem, I keep getting 0 > as the total > > What am i doing wrong. > > > $dbqueryshipping1 = "select *, COUNT(day) from > tempuserpurchase where day=\"2\" and day=\"3\" GROUP BY itemname"; > $resultshipping1 = > mysql_db_query($dbname,$dbqueryshipping1); > if(mysql_error()!=""){echo mysql_error();} > $shipping1 = mysql_fetch_array($resultshipping1); > > > > 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 >

« previous php.general (#156359) next »