Jump to content

Recommended Posts

Hi,

 

i am creating a shopping cart and am wondering how I can update a value in the array? The reason I want to do this is for the quantity of items the customer would like to buy.

 

As you can see from the code:

$disp="SELECT id, name, description, priceforpaypal, colour FROM portfolio WHERE id='{$_POST['id']}'";
$display=mysql_query($disp);
$displays=mysql_fetch_array($display);

if(empty($_SESSION['items'])){
$_SESSION['items']=array(array($displays[0],$displays[1],$displays[2],$displays[3],$displays[4],"1"));
}//end if

 

The item is added to the session array with the quantity of 1 being added at the end. I have managed to do a search so that it knows if there is a item already in the array with the same id I just don't know what to do to update that record so that the quantity can be changed i.e. +1

 

Cheers in advance guys :)

 

Rob

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.