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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:25:33+00:00 2026-05-24T20:25:33+00:00

I dabble in PHP. In the projects I’ve done I always use the database

  • 0

I dabble in PHP. In the projects I’ve done I always use the database and a cookie to handle sessions. I’ve seen “session functions” such as session_start() being used also in other sources. I’m just curious, which is better? Should I be using one or another?

  • 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-24T20:25:35+00:00Added an answer on May 24, 2026 at 8:25 pm

    Well, there’s three ways that I’ve used through-out time:

    1. The traditional $_COOKIE-way, meaning that you actually use cookies to store values
    2. The “new” $_SESSION-way, where you use an associative array that probably relies on a cookie
    3. Using $_SESSION in conjunction with the DB, making sessions controllable on a user-basis.

    I prefer using option #3, as it both enables me to alter sessions “on-the-fly”, as well as track the logged in users easier.

    Options #3 would play out in the following way (semi-pseudo):

    <?php
        //Start the session
        session_start();
    
        //Get the session data
        $_SESSION['user'] = retrieveSessionDataFromDB($_SESSION['user']['unique_id']);
    
        //Profit
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I apologize, I have dabbled with some PHP, but never done anything serious until
I have been a long-term .NET developer, but dabble in Java and PHP development
I've seen various MVC frameworks as well as standalone ORM frameworks for PHP, as
Looking to dabble with GAE and python, and I'd like to know what are
So I've been using Perl for several years now and I'm starting to dabble
My company is looking at various PHP frameworks to build a customer's site. This
I'm just starting to dabble in consuming a JSON web service, and I am
ALthough I've had to dabble in shell scripting and commands, I still consider myself
I've seen in WPF where you can bind control values to properties of other
I'm a designer who dabbles in scripting using JQuery and PHP. I have a

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.