Loading session class triggers header error

#1
[eluser]Unknown[/eluser]
Hi all,
I'm new to this forum and this is my first post, it is a really simple problem. Each time I attempt to load the session class in any of my controllers and then load a view, I get a "cannot modify header information error" in this view.
Example
Code:
<?php
class Example extends CI_Controller {
        public function Example()
        {
           parent::__construct();
           $this->load->library('session');
        }


    public function index()
    {
           $this->session->set_userdata('user','examplename');
           $user = $this->session->get_userdata('user');
           $this->load->view("example_view", array('name'=>$user));
    }

}
?>
Now if I were to run this script, I will get an error similar to
Message: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\...\example.php:6)
Filename: libraries/Session.php

Line Number: 686
The view loads, but I would really want to remove this message from it. If you have any idea about its cause please let me know

Thanks


Messages In This Thread
Loading session class triggers header error - by El Forum - 05-06-2011, 04:14 PM
Loading session class triggers header error - by El Forum - 05-06-2011, 11:30 PM
Loading session class triggers header error - by El Forum - 05-10-2011, 10:38 AM
Loading session class triggers header error - by El Forum - 05-10-2011, 10:58 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.