jimmyborofan Posted April 5, 2009 Share Posted April 5, 2009 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. 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. 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 https://forums.phpfreaks.com/topic/152651-getting-values-from-an-array-and-adjusting-db-accordingly/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.