Jump to content

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


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.

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.