-1

I am new in codeigniter. I have problem with if statement when I fetch the data from database it does not show the wanted results and I have table name 'users' and in users table one column is rights. I want that when user in login which rights has '1' they show admin authority while normal user login they show normal user. also I am using sessions. sorry for advance I am new in English. My code is

if($this->session->userdata('logged_in') && $this->session->userdata('rights')==1)
Josua Marcel C
  • 3,122
  • 6
  • 45
  • 87

1 Answers1

0

Try this

if($this->session->userdata('logged_in'))
{
$session_data = $this->session->userdata('logged_in');
if($session_data['rights']==1)
{
 //do something
}
}
Bugfixer
  • 2,547
  • 2
  • 26
  • 42