Click here to Skip to main content
13,141,747 members (65,827 online)
Rate this:
 
Please Sign up or sign in to vote.
So I have a controller in codeigniter, I wish to include a session that I have started within the same website but different folder (non codeigniter)

the session I would normal use like so

session_start();
 $userID = $_SESSION[userid];


now I can use
$userID
var anywhere within that page.

how ever I am new to codeigniter and for what I have seen I need to include session in autoload, I have done this.

Then

$session_id = $this->session->userdata('userid');


What I have tried:

private function getResults()
    {
        {
            $data['emailcount'] = $score = $this->actions->getEmailCount();
            $data['sentEmailCount'] = $score = $this->actions->getSentEmailCount();
            $data['score'] = $score = $this->actions->getScore();
            $data['percentile'] = $percentile = $this->actions->getPercentile($score);
            $data['timespent'] = $this->input->get('time');
        };
 
        $adddata = array(
            'uniID' => '5',
            'testName' => 'Abintegro E-Tray test',
            'testID' => '99999',
            'total' => '20',
            'userID' => '00000',
            'useInPercentile' => '1',
            'correct' => $score = $this->actions->getScore(),
            'percent' => $score = $this->actions->getScore(),
            'percentile' => $percentile = $this->actions->getPercentile($score),
            'dateTaken' => date('Y-m-d H:i:s'),
            'timeSpent' => $this->input->get('time'),
            'userID' => $session_id = $this->session->userdata('userid');
        );
 
 $this->actions->add_record($adddata);
        return $this->load->view('client/results', $data);
}
 
Posted 28-Nov-16 7:57am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web04 | 2.8.170915.1 | Last Updated 28 Nov 2016
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100