CodeIgniter Forums
Logic OR using == - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Logic OR using == (/showthread.php?tid=75675)



Logic OR using == - kelapamuda - 03-04-2020

Hi, i want to do this,   only superadmin and admin have access to certain menu.
I use this,,,but it not works , is it something wrong here?

if($this->session->userdata('level') ==  "superadmin" and "admin")


RE: Logic OR using == - John_Betong - 03-04-2020

Try adding round brackets because I think $admin is treated as a logical value.


RE: Logic OR using == - maxxd - 03-04-2020

You want
PHP Code:
if($this->session->userdata('level') == "superadmin" || $this->session->userdata('level') == "admin"