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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:56:16+00:00 2026-06-13T22:56:16+00:00

If I have a login system or something similar, I store a session_id and

  • 0

If I have a login system or something similar, I store a session_id and a user_id in sessions, but any other data pertaining to a certain user is stored in a database. I’ve seen other scripts where people store other data (username, email etc) in sessions.

I was just wondering, which would be “better”? Saving data in sessions from the DB or having less sessions and grabbing the data from the database?

Thanks!

  • 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-13T22:56:17+00:00Added an answer on June 13, 2026 at 10:56 pm

    You can store whatever information you like in the $_SESSION. I believe it can be up to 128Mb – limit is governed by memory_limit which is 128Mb by default. You could change this.

    However, as a rule of thumb, I’d store information that is pertinent and/or less expensive than querying a database for – Put another way as little as possible.

    It will no-doubt vary widely by use, but often, sessions contain things like:

    • Username
    • Full display names
    • Email address
    • Id’s (user or otherwise)
    • Permissions
    • User groups
    • Hashes
    • Form input errors (temporarily, to highlight form errors)

    Storing large blocks of data/info isn’t advised though for reasons of speed/scale.

    If your site/platform needs to scale at a later date, at the right point, you’d be better off looking at write-through caching or similar for frequently used/required data (e.g. Memcached) and storing the vast majority of data in your DB – where is should be.

    Hope this helps.

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

Sidebar

Related Questions

I'm pretty new to rails. I have a login system where, if data entered
I have a login system, and while logged in, if I refresh the browser,
Assume that I have login to system using PHP + MySQL, then, after I
Im looking to have a login system on my asp.net mvc website and at
We have a typical web-based login system. We want customers to have the ability
This aspect of my login system works just fine if I have the return
I have a database system developed in mysql and php, with a login system
I am working on a login system for a client and I have run
Hi I have a jQuery ajax request for a login system. At first, it
I have a simple file-system-ed-login (not mysql) just to track number of users who

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.