This involves a database, but it's 99% a PHP issue which is why I posted this in this forum.
Okay, I'm having a go at making a shopping cart system, a little mini-project to get back into PHP.
It's all going well so far, have a working login/account system. But I've hit a snag.
The way I've done it, is that all products have their own 'pid', or product ID. When a user adds a product to their shopping cart, it adds the pid of that item to the end of the users 'basket' field in the database.
So, for example, the user adds an item with a pid of '24' to his or her shopping basket, their 'basket' field would read '24'. If they then added another product with the pid '12', their basket field would then read '24, 12'. I haven't tried implementing this yet, still thinking of the best way to do it, if someone could suggest a better way, please do 😃
Okay, so here is were I'm a little stuck. Let's say that the user has added several items to their shopping basket, and are ready to order.
In my mind, I figured they would click the 'Order' button, then the PHP script would look at that users basket field, and basicly split all the numbers up into an array that I could then use to list everything that they are ordering.
That's where I'm stuck, how would I go about splitting up '12, 24, 1, 76, 1' into an array, without the commas, so it's usable in a PHP script.
Thanks,