Vincent Kituyi
Vincent Kituyi

Reputation: 119

codeigniter session not working in model

I am having issuing with session such after setting the session in my controller method, I be able to access in view but I cannot be able to access in model.

Here is the code:

public function get_username_ticket()
{
  $user = $this->db->dbprefix('users');
  $kq=$this->session->t_bys;
  $sql = "SELECT $user.*
          FROM $user
          WHERE $user.deleted=0 AND $user.id = $kq";
  return $this->db->query($sql)->row();
}

Upvotes: 1

Views: 271

Answers (1)

Naveed Ramzan
Naveed Ramzan

Reputation: 3593

You should retrieve by:

$this->session->userdata('sessionVariable');

Upvotes: 1

Related Questions