Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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

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


now I can use
PHP
$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

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


What I have tried:

PHP
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

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900