Hi all,
Can anyone tell me why the totals don't add up?
Here is the code:
if ($_POST['reg_post'] == 'Y'){
foreach ($_SESSION['cart'] as $isbn => $qty)
{
//echo $isbn;
$sql = "select movie_current_price from movie where movie_id='$isbn' AND movie_ship_charge='yes'";
$sql_result = mysql_query($sql,$connection) or die ("Could not select data");
while ($row = mysql_fetch_array($sql_result)){
$movie_current_price = $row['movie_current_price'];
//echo "$movie_current_price,";
if ($movie_current_price*$qty <= 100){
$reg_post = "1.90";
} else if ($movie_current_price*$qty >= 101 && $movie_current_price*$qty <= 200){
$reg_post = "2.95";
} else if ($movie_current_price*$qty >= 201 && $movie_current_price*$qty <= 300){
$reg_post = "4.00";
} else if ($movie_current_price*$qty >= 301){
$reg_post = "0.00";
}
}
$reg_post += $reg_post;
}
}
echo $reg_post;
You will notice that i comment out the echoing of $movie_current_price. When uncommented this correctly displays the $movie_current_price's.
However, when i go through the if else statements i am only getting the total ($reg_post) for two of the $movie_current_price's and not all three.
Any ideas how to fix this?
Cheers,
micmac