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

Link to comment
Share on other sites

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.

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.