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 6529407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:37:55+00:00 2026-05-25T09:37:55+00:00

Every time a page is loaded I connect to the database to fetch the

  • 0

Every time a page is loaded I connect to the database to fetch the settings table where the basic application settings are stored. It looks uneficcient. I have an idea to temporary store the $settings array in $_SESSION variable. So every time the script is started it checks if $_SESSION[‘settings’] is empty and loads the data from DB only if it is.

My questions are:

1)Is this normal practice or there are serious pitfalls?

2)Will this speed up my application?

  • 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-05-25T09:37:55+00:00Added an answer on May 25, 2026 at 9:37 am

    I would guess performance benefits of this would be negligible at best, and potentially harmful at worst.

    Either way $_SESSION isn’t really intended to be used this way, it’s for data relating to a specific user, and as a general rule I try to keep it as concise as possible.

    A better solution you might consider is caching the settings locally as a PHP file, it’s not too hard to script something up to generate a file that creates a simple key => value array from the database that you can include. e.g.

    <?php
    // myconfig.php
    
    return array(
        'mysetting' => 'value',
    );
    

    Then you can just include this file to get your config values:

    <?php
    // app.php
    
    $config = include('myconfig.php');
    
    echo $config['mysetting']; // 'value'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My page stops loaded every time I turn on the code below... it looks
Every time I load a new page with UIWebView the before loaded page is
okies so i have a complete ajax system every page loaded is handled though
I want to increment a cookie value every time a page is referenced even
Every time I open a page I want to get the currently active project
Every time I start Emacs I see a page of help text and a
Every time a user posts something containing < or > in a page in
NHibernate_reference.pdf, page 26: Note that ILifecycle.OnUpdate() is not called every time the object's persistent
When using Visual Studio's built in web server, every time I make a page
Every time I turn on my company-owned development machine, I have to kill 10+

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.