Session Set - Codeigniter

Session Set

Snippet Code


  
Rate this page :
  [ 0 votes]

This is the code, how to set session while fetching data from mysql table.. before using this code you have to load session library in constructor $this->load->library('session');

$query = $this->db->get_where('admin', array('username' => $uname, 'password' => $en_password)); if ($query->num_rows()==1){ $data = $query->result_array(); foreach($data as $key => $row) { $this->session->set_userdata($row); } }

Tags


Ask Questions

Ask Question