Posts

Showing posts from December 14, 2018

Explode and Set if condition php

Image
up vote 0 down vote favorite Array ( [0] => 1 [1] => 2 ) I'm trying to set an if condition based on user permission, the idea is to show menu based on given values, if it is 1, one menu will be displayed and 2 second menu will be displayed, if its both then all values will be displayed. So far for single values i have gotten it right but how to do it for array of values This is my code <?php $userid = $this->phpsession->get("user_id"); $userrole = $this->phpsession->get("user_type"); $query = $this->db->select("role_empid,role_permissions")->from('hw_role')->where('role_empid', $userid)->get()->result(); $data = $query[0]->role_permissions; if($data == 1){ ?> <li><a href="<?php echo bas