i am using MYSQL as my database.
Due to i have multiple selection of categories one of them is Others
Once the user selected the Others it will shown a textbox which let the user to input a new category.
But now i have problem is how can i add the new column into existing table?

Let's said the existing table is

Cateogry

|Foods|Drinks|Entertaiment|
---------------------------
    <<        DATA        >>

i just want add the new column beside the Entertaiment
New column name : NEWCOLUMN

Recommended Answers

All 4 Replies

That's a strange way of going about it, but you'll need to run something like this:

ALTER TABLE Category ADD COLUMN NewColumn VARCHAR(64)

Are you going to allow each user to create their own column? If so, this solution is not likely to be scalable. You'd need to consider an Entity–attribute–value (EAV) model for the table, at least for the custom, user specific data.

You might want to rethink your database design. A catagory list should be a table lookup, which in turn is referenced in a data table.

You have a database diagram you could show?

I am already redesign my database, thus this is no use already.
Thanks for helping. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.