I tried using the print_r for $shipping. - All i want this to do is to check to see what days in the grouping is there, and if there is anything for a grouping, charge $5 for the delivery. If there are items in two of the groupings, charge $10 and if there is in all three groupings, charge $15.
This is what print_r has returned. Array ( [0] => 4 [day] => 4 [1] => 4 [COUNT(*)] => 4 ) 11Array ( [0] => 1 [day] => 1 [1] => 9 [COUNT(*)] => 9 ) 1amount from DB query10 This is the code I have done, showing the print_r's for Shipping 1, 2 and 3. <? $dbqueryshipping1 = "select day, COUNT(*) from tempuserpurchase where day=\"2\" or day=\"3\" GROUP BY day"; $resultshipping1 = mysql_db_query($dbname,$dbqueryshipping1); if(mysql_error()!=""){echo mysql_error();} $shipping1 = mysql_fetch_array($resultshipping1); $dbqueryshipping2 = "select day, COUNT(*) from tempuserpurchase where day=\"4\" or day=\"5\" GROUP BY day"; $resultshipping2 = mysql_db_query($dbname,$dbqueryshipping2); if(mysql_error()!=""){echo mysql_error();} $shipping1 = mysql_fetch_array($resultshipping2); $dbqueryshipping3 = "select day, COUNT(*) from tempuserpurchase where day=\"6\" or day=\"7\" or day=\"1\" GROUP BY day"; $resultshipping3 = mysql_db_query($dbname,$dbqueryshipping3); if(mysql_error()!=""){echo mysql_error();} $shipping3 = mysql_fetch_array($resultshipping3); if(($shipping1 > "") and ($shipping2 > "") and ($shipping3 > "")) { $shipping=15;} elseif((($shipping1 > "") and ($shipping2 > "")) or (($shipping2 > "") and ($shipping3 > "")) or (($shipping1 > "") and ($shipping3 > ""))) { $shipping=10;} elseif(($shipping1 > "") or ($shipping2 > "") or ($shipping3 > "")) { $shipping=5;} else{ $shipping=0;} echo print_r($shipping1); echo print_r($shipping2); echo print_r($shipping3); echo "amount from DB query"; echo $shipping; ?> ----- Original Message ----- From: "Curt Zirzow" <[EMAIL PROTECTED]> To: "PHP List" <[EMAIL PROTECTED]> Sent: Tuesday, July 22, 2003 5:23 PM Subject: Re: [PHP] MySQL/PHP problem. > * Thus wrote Phillip Blancher ([EMAIL PROTECTED]): > > 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. > > > > > --- 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