Results 1 to 4 of 4

Thread: [RESOLVED] Best Practice: Multiselect List

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2008
    Posts
    790

    Resolved [RESOLVED] Best Practice: Multiselect List

    Using php/mysql.

    I have a form to submit info to a table.

    On the form I have a multiselect list box. Is it better to store a comma delimited string to one single field in the table once the form is submitted, or should I create a join table that has a separate row for each selected object in the list box?

    What's the better option?

    I am thinking I should create a join table, since each list item is linked to a table called "options".

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Best Practice: Multiselect List

    Thread moved.

  3. #3
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    7,902

    Re: Best Practice: Multiselect List

    You're thinking is exactly right

    A comma separated list will work but it's going to give you a million and one problems down the line. Databases are designed to work by rows in tables and that's going to be the best solution for you at every step of the way. If you want some background as to why then read up on "normalisation".
    The best argument against democracy is a five minute conversation with the average voter - Winston Churchill

    Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2008
    Posts
    790

    Re: Best Practice: Multiselect List

    Thanks FunkyDexter!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width