1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2007
    Rep Power

    Making new categories

    I just need idea how to do that.
    Let's say I have 3 categories represented by 3 different mysql tables. But I want to add one more category through PHP script.
    How to do that, to make one more mysql table
  2. #2
  3. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Rep Power

    Just like you do it in any other case: with a "CREATE TABLE" query.

    However, dynamically creating tables normally doesn't make sense. You should rather make a "categories" table and then insert a row for every category.
  4. #3
  5. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Pennsylvania, USA
    Rep Power
    Your underlying design is wrong. You should combine these tables into an entity-attribute-value model with "category" being one of the global attributes.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.

IMN logo majestic logo threadwatch logo seochat tools logo