excuse me I have little problem what is right syntax to access page if I have condition like this (status) in session if status=0 and 2 can be access pegawai
this if status=0,
<?php if($this->session->userdata('STATUS')==0) {?> <li><a href="<?php echo base_url() ?>pegawai"><i class="icon-user"></i>Pegawai</a></li><?php } ?>
so I want this page can be access if status 0 and 2 what syntax that should be used?
I have make this
<?php
if($this->session->userdata('STATUS')==0) {
?>
<li><a href="<?php echo base_url() ?>pegawai"><i class="icon-user"></i>Pegawai</a></li>
<?php
}
?>
<?php
if($this->session->userdata('STATUS')==2) {
?>
<li><a href="<?php echo base_url() ?>pegawai"><i class="icon-user"></i>Pegawai</a></li>
<?php
}
?>
so if status 0 and 2 can be acces but it's not efficient
Are you asking how to use an Or
logical operator?
<?php if($this->session->userdata('STATUS')==0 || $this->session->userdata('STATUS')==2): ?>
<li><a href="<?php echo base_url() ?>pegawai"><i class="icon-user"></i>Pegawai</a></li>
<?php endif; ?>
Answering but also down-voting this and suggesting you close it. Shows a lack of searching for the answer. You might want to read an intro to coding PHP.
Make it simpler like this
<?php
if( $this->session->userdata('STATUS')==0 || $this->session->userdata('STATUS')==2) {
?>
<li><a href="<?php echo base_url() ?>pegawai"><i class="icon-user"></i>Pegawai</a></li>
<?php
}
?>