Jump to content

How to Recreate Mysql Table Structure Using PHP


HungryMind
 Share

Recommended Posts

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...