Quantcast
Channel: CodeIgniter Forums - All Forums
Viewing all articles
Browse latest Browse all 14346

How to use case statement instead of if statement in codeigniter

$
0
0
I have a code below which seems not to be working so I would want to try case statement instead
Code:
 <td>
      <?php $is_author = $message->user_id == $this->session->userdata('id'); ?>
      <?php if($is_author): ?>
      <?php echo anchor('admin/messages/edit/'.$message->id.'', 'Edit', 'class="btn btn-primary"'); ?>
      <?php echo anchor('admin/messages/delete/'.$message->id.'', 'Delete', 'class="btn btn-danger"'); ?>
      <?php else: ?>
      <?php echo anchor('admin/messages/approve/'.$message->id.'', 'Approve', 'class="btn btn-success"'); ?>
      <?php endif; ?>
  </td>


I need help to solve the if statement or change it to case statement if it can work pliz.

Viewing all articles
Browse latest Browse all 14346

Trending Articles