Jump to content

getting values from an array and adjusting db accordingly


jimmyborofan

Recommended Posts

Hi i got this problem...  >:(

 

basically I have an array say:

 

$cartArray this is a session variable and it stores the value of a cart.

 

the array contains the items that the user has clicked on and chosen to add.

 

now I have done all the transaction work I have added the transaction to the db, I have closed the session when it everything has been done, I am now stuck with the problem of stock. :-[

 

 

the array contains the names of the items and nothing else i have used this array to retrieve price information from the db so that the user gets a total price so I have no probems there. ;D

 

this is where it gets difficult, adjusting the stock values, :-\

 

I somehow how to get the number of times that each value has appeared in the array ( I am doing this with the array_count_values() function)

 

so I am now left with another array which lists how many times each item has been listed in the cart, I have this done so far and can display what the array contains, so I know that this is working. ;D

 

now I have my difficult bit which I am having problems,  >:(

 

how can take the values from this counted array and use them to adjust the values of stock in the db? ???

 

I am really stuck! if someone could let me know which functions would come in useful or a few pointers I would be made up! thanks in advance

 

 

Jimmy

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.