I am using codeigniter framework for one of my inventory management systems. I prefer using php due to its variable functionality which makes things easier.
So I am trying to get the username from session and then check the database for the level of the user and accordingly he should be able to view links in the navigation menu.
$this->db->select('level');
$this->db->where('name', $this->session->userdata('name'));
$query = $this->db->get('admin');
if ($query) {
foreach ($query->result() as $row)
{
echo $row->level ;
}
}
This works fine and gets the level of the logged in user. Now I want to use a if condition with this value, so I am using this -
if ($this->$row->level = '3') {
?>
<li class="">
<a href="http://example.com/crm/emp_rep1.php">Employee Sales Report</a>
</li>
<?php } ?>
But nothing seems to happen here, No error or any notice.
I have no clue what I am doing wrong here.