Jump to content

PHP and MySQL help please?!


hlstriker

Recommended Posts

Hey I have a quick question. I am trying to make a page that users can sign up, then later on add things of what they have to sell. Would I need to give each user their own table for this, or could I somehow do it with 1 table?

For example: User "Ned" signs up, then he later on adds things to sell (which would go into a field).

There will be multiple users, that's why I wondered if I had to make more then 1 table, since I don't know if there could be multiple item's in 1 field?
Link to comment
Share on other sites

Two tables - one for users, the other for items for sale

table 1: user_id, username, password, email, whatever else - one record per user
table 2: id, user_id, item_for_sale,price, whatever else - one record per item for sale
Link to comment
Share on other sites

[quote author=AndyB link=topic=102022.msg404360#msg404360 date=1153972828]
Two tables - one for users, the other for items for sale

table 1: user_id, username, password, email, whatever else - one record per user
table 2: id, user_id, item_for_sale,price, whatever else - one record per item for sale
[/quote]


Is id in table 2 a primary key? If so, what if a user_id has many things to sell? Shouldn't there be just a table that list just the unique item for sell?
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.