Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re^2: settuping up pseudo tables in mysql shopping cart

by coldfingertips (Pilgrim)
on Nov 28, 2005 at 19:51 UTC ( #512349=note: print w/replies, xml ) Need Help??

in reply to Re: settuping up pseudo tables in mysql shopping cart
in thread setting up pseudo tables in mysql shopping cart

Are you saying to have a table set up like this?
id unique userid itemname itemnum qty price itemweight 307 af4jsdfds frog 34 4 2.50 4.5 308 8843kksd bear 12 2 8.00 5.0 309 af4jsdfds bear 5 3 8.00 5.0
And then when I need the information for a userid, I look up every column containing it?

Replies are listed 'Best First'.
Re^3: settuping up pseudo tables in mysql shopping cart
by chromatic (Archbishop) on Nov 28, 2005 at 21:34 UTC

    No. Create a table for each unique type of entity in your system: a Customer, perhaps an Address, an Item for sale, and an Order. Then create a table for each one to many relationship in the system. An Order contains many Items, so you need an Order_Items table.

    Then to add an order, find the Customer's id (creating a Customer or using an existing one). Create a new Order. Add a row to the Order_Items table for each Item in the Order.

    Every unique entity in the system should occur only once in the system. That's basically the normalization rule to go by.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://512349]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2022-12-05 11:08 GMT
Find Nodes?
    Voting Booth?

    No recent polls found