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

 

Link to comment
Share on other sites

$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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.