Hi all,
I am having trouble getting my count right. Here is the code:
foreach ($_SESSION['cart'] as $isbn => $qty){
$sql_charge = "select * from movie where movie_id='$isbn' AND movie_ship_charge='yes'";
$result_charge = mysql_query($sql_charge);
while ($row = mysql_fetch_array($result_charge)){
$movie_stock = $row['movie_stock'];
$movie_ship_charge = $row['movie_ship_charge'];
if ($movie_stock == 'yes' && ($movie_ship_charge == 'yes' || $movie_ship_charge == 'no')){
$qty_count = 1;
} else if($movie_stock == 'no' && $movie_ship_charge == 'yes'){
$qty_count2 = 1;
}
if ($new_qty_count >= 2 || $new_qty_count2 >= 2){
$pSQL = "select pcRate from postalcharges WHERE pcCountryID='14' AND pcShipType='1' AND pcWeight=0";
} else {
$pSQL = "select pcRate from postalcharges WHERE pcCountryID='14' AND pcShipType='1' AND pcWeight='$qty'";
}
$pSQL_result = mysql_query($pSQL);
$row2 = mysql_fetch_array($pSQL_result);
$pcRate[$isbn] = $row2['pcRate'];
}
}
$pcRate = array_sum($pcRate);
It is incomplete at the moment. How do i get it to add the $qty_count and the $qty_count2 up?
If the total of either of these variables is greater than 2 then i want it to execute the second query.
Any help greatly appreciated.
Cheers,
micmac