Welcome Guest, Not a member yet? Register   Sign In
How to use session in codeiniter
#1

[eluser]manishchndk[/eluser]
I have written the following code in my controller but it is giving me error : Parse error

<?php

class Login extends Controller {

function Login()
{
parent::Controller();
$this->load->library('session');
$this->load->helper('url');
}

function index()
{
$a = array(
'session_id' => 'random hash',
'last_activity' => 'timestamp'
)

$this->session->mani($a);
$this->load->view('admin/admin_login_view');
}

}
#2

[eluser]kikz4life[/eluser]
please read the user guide.
For setting session first you will need to set the array you want:
Code:
$a = array(
        ‘session_id’  => ‘random hash’,
        ‘last_activity’ => ‘timestamp’
      )
$this->session-set_userdata($a)

then to used those array

Code:
$this->session->userdata('session_id')




Theme © iAndrew 2016 - Forum software by © MyBB