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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:11:17+00:00 2026-05-26T01:11:17+00:00

I use CodeIgniter and save Sessions in my DB. The following line of code

  • 0

I use CodeIgniter and save Sessions in my DB.

The following line of code will be executed if the users try to login and the login is successfull (found his data in the db):

$this -> session -> set_userdata($account_data); /login-page

After this i redirect the user to my dashboard. The dashboard tries now to read the $account_data from the session.
BUT

$this -> session -> all_userdata(); /dashboard

outputs only the standard session content from codeigniter.
I check the session after the set_userdata call (above) and the array is loaded. But there is no db-entry for this session.
Ok i call the all_userdata(); in the dashboard – it shows the standard content of the session AND the data is saved in my db.

Summary:

LoginPage – Load some Accountdata and save it in a Session. I can load the Accountdata from this session. NO db-entry

Dashboard – Session contains only the standard content of codeigniters session. DB-Entry with this data exists.

Only at the beginning of the LoginPage i destroy the session.

I’m a little bit confused, it seems the session is not “transported” to the next site.

Any tips?

Edit: Test-Case

 public function testSessionStart(){
           if ($this->session->userdata('key')){

           }else{
               $this->session->sess_destroy();
           }

            $this->session->set_userdata('key','12345566');
            debug($this->session->all_userdata());
            debug($this->session->userdata('session_id'));
            echo "<br><a href='".base_url()."login/testSessionEnd'>Klick me</a>";
        }

        public function testSessionEnd(){
            $this->session->set_userdata('sid','hasd12312kasdj89d');
            debug($this->session->all_userdata());
            debug($this->session->userdata('session_id'));
        }

If the Start func is called, the db never get’s an entry.
End func generates a new Session and save it to the db.
i have no idea why

  • 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-26T01:11:18+00:00Added an answer on May 26, 2026 at 1:11 am

    You should note that You can not access the Session Data in the same page where you set Session Data. If there is no DB Entry please check your DB Structure and read this page carefully. Hope it will solve your problem.

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

Sidebar

Related Questions

I use codeigniter and i want make uniqid code with php as following code(by
I use CodeIgniter as my web application framework. I used a simple Try/Catch and
I'm trying to use CodeIgniter, and xdebug. When I type in the following URL:
I use CodeIgniter + Tank Auth. Only the code http://localhost/XXXXXXXX/auth/forgot_password doesn't work. The result
I have an interesting issue :/ I use CodeIgniter and the code below is
I am trying to learn CodeIgniter to use for a shopping site, but I
in codeigniter you can use wildcard to reroute. i never heard the word wildcards
should i use Classname() or __construct() as constructor in CodeIgniter? both work, which should
I'm running a LAMP environment with CodeIgniter. I want to be able to use
Is there a way to integrate CodeIgniter with phpBB3? I would like to use

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.