Welcome Guest, Not a member yet? Register   Sign In
Cannot retive the session
#1

I can store the session but i cannot retrieve it , if i try to retrieve , it is just null   .please help me  here i have attached my coding

<?php

class Login extends CI_Controller{


function index(){
$data['main_content']='login_form';

$this->load->view('includes/templates',$data);
}


function validation(){

$this->load->model('membership_validation');
$result=$this->membership_validation->validation();

if($result){

$data[]=array(

'username' => $this->input->post('username'),
'log' => TRUE,
);

$this->session->set_userdata($data);


//echo $data->$username;

$name=$this->session->userdata('username');

$log=$this->session->userdata('log');

echo $log;//RESULT IS NULL
echo $h; // RESULT IS NULL




}



}


BUT I RETRIEVE ALL DATA like this it shows
like below
i can see that my session is stored
the output for  

$this->session->all_userdata(); ,
Array ( [session_id] => 2b9b1c3cadf7cd7ff49
c6b576244d2dc [ip_address] => ::1 [user_agent] => Mozilla/5.0 (Windows NT 6.1; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0 [last_activity] => 1420380027 [user_data] => [0] => Array ( [username] => thamarai [log] => 1 ) )



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

echo $s;// it is working it shows some id , but the session which i'm storing like username, log. i cant retrieve it
Thanks and Regards,
Thamaraiselvam T
Reply


Messages In This Thread
Cannot retive the session - by Thamaraiselvam - 01-04-2015, 08:06 AM
RE: Cannot retive the session - by Mohammadhzp - 01-04-2015, 10:10 AM



Theme © iAndrew 2016 - Forum software by © MyBB