hlstriker Posted July 27, 2006 Share Posted July 27, 2006 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? Quote Link to comment https://forums.phpfreaks.com/topic/15772-php-and-mysql-help-please/ Share on other sites More sharing options...
AndyB Posted July 27, 2006 Share Posted July 27, 2006 Two tables - one for users, the other for items for saletable 1: user_id, username, password, email, whatever else - one record per usertable 2: id, user_id, item_for_sale,price, whatever else - one record per item for sale Quote Link to comment https://forums.phpfreaks.com/topic/15772-php-and-mysql-help-please/#findComment-64482 Share on other sites More sharing options...
hlstriker Posted July 27, 2006 Author Share Posted July 27, 2006 Thanks alot AndyB! :D Quote Link to comment https://forums.phpfreaks.com/topic/15772-php-and-mysql-help-please/#findComment-64486 Share on other sites More sharing options...
extrovertive Posted July 27, 2006 Share Posted July 27, 2006 [quote author=AndyB link=topic=102022.msg404360#msg404360 date=1153972828]Two tables - one for users, the other for items for saletable 1: user_id, username, password, email, whatever else - one record per usertable 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? Quote Link to comment https://forums.phpfreaks.com/topic/15772-php-and-mysql-help-please/#findComment-64521 Share on other sites More sharing options...
sonal4php Posted July 27, 2006 Share Posted July 27, 2006 user_id is primary key for 1st tableand id for second tableif a user inputs multiple items , those will be saved to second table against same user_idso while fetching,fetch all rows and create table or something like that..... Quote Link to comment https://forums.phpfreaks.com/topic/15772-php-and-mysql-help-please/#findComment-64567 Share on other sites More sharing options...
extrovertive Posted July 27, 2006 Share Posted July 27, 2006 Ah I see now. Quote Link to comment https://forums.phpfreaks.com/topic/15772-php-and-mysql-help-please/#findComment-64760 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.