menios Posted November 30, 2007 Share Posted November 30, 2007 Hi I currently have a table with products and another one with categories. the structure is: table_category table_product cat_id(PrimaryKey) pd_id (Primary key) cat_name cat_id(FK) pd_name pd_qty All items in products belong to different categories. Now i want to link each product with a certain category how can i do this? Thanks for any help:) Link to comment https://forums.phpfreaks.com/topic/79572-keys/ Share on other sites More sharing options...
fenway Posted November 30, 2007 Share Posted November 30, 2007 You need a third table with ( pd_id, cat_id ) records. Link to comment https://forums.phpfreaks.com/topic/79572-keys/#findComment-403039 Share on other sites More sharing options...
menios Posted November 30, 2007 Author Share Posted November 30, 2007 Can you be a bit more specific on the structure pls? I create another table and how do i link it? Link to comment https://forums.phpfreaks.com/topic/79572-keys/#findComment-403045 Share on other sites More sharing options...
fenway Posted November 30, 2007 Share Posted November 30, 2007 That's the structure -- two FK fields and probably a UID. You "link" them by insert a record that ties the two existing table records together. Link to comment https://forums.phpfreaks.com/topic/79572-keys/#findComment-403051 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.