Creating a SESSION:  

   In codeigniter session variables are capable of having array values into them.

Syntax:
   
First of all we have to start the session library ,$this->load->library('session');
     $mydata = array(
                   'username'  => 'x',
                   'email'     => 'x@somemail.com'
                   
               );

    $this->session->set_yourvariablename($mydata);




Reading the SESSION data:

         $this->session->all_yourvariablename();

This returns all values that are stored in session variable name.But to get a particular session item
     
          $this->session->yourvariablename('username');



Destroying a SESION data:

          $this->session->sess_destroy();
   This destroys all session datas available in that application.

          $this->session->unset_yourvariablename('$mydata');
    this will unset the particular user's selected values.