Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8741939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:24:31+00:00 2026-06-13T11:24:31+00:00

I’m wondering what best tactic is for saving a large array of user preferences

  • 0

I’m wondering what best tactic is for saving a large array of user preferences for a website. Mostly things like default values, like default timezone, default text size, etc. Making a separate column for each setting doesn’t sound practical. The only way I can think of currently is to add a singe column in the users table for preferences, and put all the settings in there.

For example, I could use formatting like this in one column only: timezone:GMT;text_size:12;default_value1:something;default_value2:FALSE. Then when grabbing it in PHP, I would select this column for the logged in user and do an explode on the result, setting $_SESSION[‘settings’][‘setting_key’] = “setting_value”.

Is there a smarter way to do this, or am I already in the right direction? The only downside to this is not being able to search through each specific setting, of course, since everything is lumped together.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:24:32+00:00Added an answer on June 13, 2026 at 11:24 am

    IMHO that’s what serialize is just perfectly meant for.

    If you want it searchable you might want to end up splitting them up.
    On the other hand, you might want to take a totally different approach and instead of storing in a large table with setting per column, you can create a table of a kind:

    CREATE TABLE settings (user_id INT, setting VARCHAR, value VARCHAR)
    

    and store settings like that. Then you are not limited by adding/removing columns.

    Another approach (to further speed up possible settings lookups) would be to create a multiple of tables:

    CREATE TABLE settings (id INT, setting VARCHAR)
    CREATE TABLE settings_values (user_id INT, setting_id INT, value VARCHAR)
    

    considering that setting_id is a foreign key to settings.id and assuming that you have some users table that has user id’s where user_id is a foreign key to in both examples.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
I've got a string that has curly quotes in it. I'd like to replace
I am trying to render a haml file in a javascript response like so:
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I would like to count the length of a string with PHP. The string
I have an array which has BIG numbers and small numbers in it. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.