Welcome Guest, Not a member yet? Register   Sign In
code igniter : Weird problem : problem just in chrome : works fine in IE and Moz
#1

[eluser]technology.guy[/eluser]
I have a function as below in controller_a



Code:
function abc()
        {
            $this->load->model('model_a');
            $query = $this->model_b->get_data();
            
            if($query)
            {
    
                 $data = array(
                                'a'  => true,
                                'b'  => $query->b,
                                'c'     => $query->c,
                              );
                  
                $this->session->set_userdata($data);
                redirect('controller_a/view_a'); // simply calls a function that loads view_a
            }
The problem is that in view_a

<?php echo $this->session->userdata('a'); works fine for b also works fine but for c it doesnt show anything.

Also I tried echoing $query->c int the controller before setting the data works fine but cant access it in the view .... dont know what is the problem

Any help will be appreciated
Thanks
#2

[eluser]bgreene[/eluser]
maybe delete the comma after ->c ??
#3

[eluser]BaCeTo[/eluser]
$this->session->userdata('a') may be unaccessible in the view. You may try with $CI = get_instance();
and then $CI->session->userdata. $this variable will be accessible only in the controller. You shouldn't be able to use it inside the view. Also you are loading "model_a" in the example, but then try to access model_b. How does that work for you ?
#4

[eluser]vitoco[/eluser]
can 'c' be a "reserved variable" in the session data? did you tried with another var name ??

Saludos




Theme © iAndrew 2016 - Forum software by © MyBB