CodeIgniter Forums
code igniter : Weird problem : problem just in chrome : works fine in IE and Moz - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: code igniter : Weird problem : problem just in chrome : works fine in IE and Moz (/showthread.php?tid=42376)



code igniter : Weird problem : problem just in chrome : works fine in IE and Moz - El Forum - 06-05-2011

[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


code igniter : Weird problem : problem just in chrome : works fine in IE and Moz - El Forum - 06-06-2011

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


code igniter : Weird problem : problem just in chrome : works fine in IE and Moz - El Forum - 06-07-2011

[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 ?


code igniter : Weird problem : problem just in chrome : works fine in IE and Moz - El Forum - 06-09-2011

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

Saludos