Jump to content

[SOLVED] if else statement? count function? loop funtion? Help please.


zac1987

Recommended Posts

$checkbox_value=$_POST["selectlist"];

for($i=0;$i<1;$i++){

$query1 = "SELECT * FROM shoping_cart where reserve_id = {$checkbox_value[$i]} ";

$result1 = mysql_query($query1,$connection) or die (mysql_error());

confirm_query($result1);

while($cart_list = mysql_fetch_array($result1)){

$item = $cart_list['item'];

$updated_available_quantity = $cart_list['available_quantity'] + $cart_list['quantity'];

 

echo $updated_available_quantity . "-" .  $item. "<br />";

echo $cart_list['available_quantity'] . "<br /><br />";

}

 

The output:

89-Man Wig

88

 

94-Man Wig

88

 

My Problem

how to make the output like below?

89-Man Wig

88

 

95-Man Wig

89

 

$query4 = "SELECT * FROM shoping_cart where id = {$checkbox_value[$i]}"

$result4 = mysql_query($query4);

while($cart_list = mysql_fetch_array($result4)){

$total_quantity = $total_quantity  -  $cart_list['quantity'];

$updated_available_quantity = $cart_list['available_quantity'] - $total_quantity;

 

let say check box has select 2 items - (two lists of wig and 1 list of pendrive)

$total_quantity will add up all the 3 lists quantity.

 

How to make the $total_quantity add up the quantity of wig and pendrive seperately?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.