Jump to content

Passing multi items to database - shopping cart.


redyard

Recommended Posts

Hi all,

 

I'm developing/designing a shopping cart with a flash front end and php/MySQL.

 

The products information in the basket are stored in Objects which are stored in an array - so the information to be passed to the database is an array of objects and each object describes a product in the basket. 

 

The problem I have is how do I pass this array of objects to the database considering they will all be related to one customer.

 

Is it possible to pass an array to php ?

 

 

Any help in this area would be greatly appreicated.

 

R

i might be wrong cause Iam still new but i would create a a new table in mysql that holds basically

 

user_id(buyer)| product_id

 

now when the buyer adds to his cart you can add to the table. So lets say John has 3 diff items in his cart

 

Jon | Ps3

Jon | Wii

Jon | X360

 

then you can do like SELECT * from TABLE where user_id = Jon

 

you can pass all that into an array and now you know what products he has. When he checks out u delete all

the products from the table. This table will also be used at the same time with other users.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.