Jump to content

Php Unable To Increment Any Value But The Last Added To The Array


Accolade

Recommended Posts

Your code that is setting $_SESSION['invoice'][$comic_id] is outside of and after the end of your loop. You would need to put in with the code that is fetching the data from the query result and setting the $name, $qty, and $price variables.

When changing

 

foreach ($_SESSION['invoice'] as $value) {
echo $value."<br>";}

 

to....

 

 

foreach ($_SESSION['cart'] as $value) {
echo $value."<br>";}

 

The correct $qty and only the $qty is being outputted for each $comic_id in order.

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.