SirChick Posted August 25, 2007 Share Posted August 25, 2007 I haven't had this problem up to now so im unsure on what to do. Basically one item can be owned by many users... and 1 user can have many of that 1 item...and many other items also so how would you link the tables exactly in the database :S Quote Link to comment https://forums.phpfreaks.com/topic/66697-solved-what-do-you-do-if-u-got-a-many-to-many-link-with-tables/ Share on other sites More sharing options...
Barand Posted August 25, 2007 Share Posted August 25, 2007 you need an intermediate link table [pre] user useritem item --------- ----------- --------- id --+ id +-- id name +--< user_id | name qty | item_id >--+ Quote Link to comment https://forums.phpfreaks.com/topic/66697-solved-what-do-you-do-if-u-got-a-many-to-many-link-with-tables/#findComment-334152 Share on other sites More sharing options...
SirChick Posted August 25, 2007 Author Share Posted August 25, 2007 so if i was to query to search for all items under a user id i would search the middle table ? Quote Link to comment https://forums.phpfreaks.com/topic/66697-solved-what-do-you-do-if-u-got-a-many-to-many-link-with-tables/#findComment-334156 Share on other sites More sharing options...
Barand Posted August 25, 2007 Share Posted August 25, 2007 useritem joined with item if you want the item names Quote Link to comment https://forums.phpfreaks.com/topic/66697-solved-what-do-you-do-if-u-got-a-many-to-many-link-with-tables/#findComment-334160 Share on other sites More sharing options...
SirChick Posted August 25, 2007 Author Share Posted August 25, 2007 ok ! thankyou Quote Link to comment https://forums.phpfreaks.com/topic/66697-solved-what-do-you-do-if-u-got-a-many-to-many-link-with-tables/#findComment-334164 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.