Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Feb 2003
    Posts
    345
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question What is your prefered way to deal with users and their preferences?

    What is your prefered way to deal with users and their preferences?

    Do you rather use true/false, 1/0, yes/no, other...?[/LIST]

    How do you store them in the db? in an array? single columns for each pref?

    What kind of problems have you encountered so far with a method you've chosen?

    I'd just like to learn from your experiences...

  • #2
    Senior Coder
    Join Date
    Apr 2005
    Posts
    1,051
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i generally use a mix of array values within a single column, and single values in columns.

    for things like colour scheme options i store them in an array in a single column (knowing the order i need to pull them in).

    for singular things like display names, or birthdays i store them in their own column.

    I find this is best because the values you will most likely be using together are stored together. and therefore easier to manage.
    public string ConjunctionJunction(string words, string phrases, string clauses)
    {
    return (String)(words + phrases + clauses);
    }
    <--- Was I Helpfull? Let me know ---<

  • #3
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    I agree with rlemon, I store them in their own fields often with 0/1 as the switch.

    also I beleive that "true/false" values are really only for access databases, or maybe MSSQL.

    I only use arrays for storing formation like options from multiple checkboxes.

    -SiX

  • #4
    Senior Coder
    Join Date
    Apr 2005
    Location
    Colorado, United States
    Posts
    1,208
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I use a column per user option...an ENUM('0', '1') if it's a true/false type thing. Otherwise I use as appropriate, such as varchar for a text field, same for multiple checkboxes, I just store a serialize()'d array.
    "$question = ( to() ) ? be() : ~be();"

  • #5
    Regular Coder ralph l mayo's Avatar
    Join Date
    Nov 2005
    Posts
    951
    Thanks
    1
    Thanked 31 Times in 29 Posts
    The most efficient way to store binary options is generally to use each bit of and INT field. Eg, if you have 4 bit INT (up to 16), you can make each bit stand for show email, show im, show sig, and allow pms.


  •  

    Posting Permissions

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