Categories

Discussion in 'PHP' started by spikesforu, May 13, 2010.

  1. #1
    In my categories file I have the option to add 1 category per profile I would like to add many how do I go about getting this accomplished. Running MySql 5.0

    Thanks
     
    spikesforu, May 13, 2010 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,901
    Likes Received:
    4,555
    Best Answers:
    123
    Trophy Points:
    665
    #2
    The best way, but not necessarily the easiest to code, is to have a table with all the categories in it, and a table with profile_id and category_id linking the categories to the profiles. Its Many:Many since a category could apply to many profiles as well as the profiles having many categories.
     
    sarahk, May 13, 2010 IP
  3. spikesforu

    spikesforu Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I have table for both and was able to give the table multiple capability but I think the problem is in the MySQL it will only take 1 category.
     
    spikesforu, May 13, 2010 IP
  4. sarahk

    sarahk iTamer Staff

    Messages:
    28,901
    Likes Received:
    4,555
    Best Answers:
    123
    Trophy Points:
    665
    #4
    MySQL is just a big bucket that catches whatever you throw at it.

    Either your tables aren't right or your coding isn't right.

    The code is too complex to give you an example. It all depends on how you want the user interface to work etc.
     
    sarahk, May 13, 2010 IP