HungryMind Posted August 16, 2011 Share Posted August 16, 2011 Hi, I want to re-structure my mysql table. mysql_query("CREATE TABLE test(id INT NOT NULL AUTO_INCREMENT, category_a VARCHAR(30))") or die(mysql_error()); Now! i want to add another fields in this table structure.If admin want to create field category_b and category_c.Should i change table structure and add required fields.Or i should have to redesign database structure.So is it a good way?Like:table: testfields: user_id, categoriesfield values: category afield values: category bfield values: category cI want this type of result.userid: 1, category: auserid: 1, category: buserid: 1, category: cit'll possible in 3 rowsI was trying.userid: 1, category_a: a, category_b: b, category_c: c // It's possible in one rowPlease guide. Link to comment Share on other sites More sharing options...
justsomeguy Posted August 16, 2011 Share Posted August 16, 2011 It's better to use a lookup table with 2 columns to hold the user ID and category ID. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.