Forum Moderators: coopster

Message Too Old, No Replies

Help with php/mysql application. What's the best way to do this?

Help with php/mysql application. What's the best way to do this?

         

dwalls32

4:36 pm on Sep 7, 2007 (gmt 0)

10+ Year Member



Currently I am rebuilding my photo website where users can purchase prints of restored photos. I have a users table which holds registration and user data, an images table which holds the photo information, and a table that holds all of the current sizes of prints available for purchase(4x6, 8x10) and their cost and sell prices.

What I want to know is what is the best way to record this to the mysql database so that the user can purchase 1 8x10, 4 4x6's etc. Would it be to make a table that is a photo order table that generates an order number and is tied to a user, then have a separate table that holds the photo type and quantity of prints and is tied to the photo order table?

The other problem is that non-registered users can also purchase photos, and those users do not have records in the user table, they simply have an e-mail address in the image table.

Thanks for any help in advance.

d40sithui

5:36 pm on Sep 7, 2007 (gmt 0)

10+ Year Member



i think this might get you started. one way is to have an "order" table, and a "shipping" table.

1)the "shipping" table would contain a unique order id(auto_incremented) for each order, as well as all required shipping information for that order, whether a registered user or otherwise.

2)the "order" table would contain all items that is in that order, which is tied to the unique id from the table "shipping"...so u can have multiple instances of the id in the order table (but not shipping) to store multiple items ordered for the same order.

...as a note to your registered user and anonymous user ordering problem, perhaps you should not store order information in the same table for these two categories...im not sure exactly why, but it seems to be better programming practices

dwalls32

5:39 pm on Sep 7, 2007 (gmt 0)

10+ Year Member



d40sithui, thank you very much! That makes perfect sense! I'm still very new to the mysql/php thing so thanks very much for your help.