Welcome Guest, Not a member yet? Register   Sign In
How do i check if table item is either true or false
#1

(This post was last modified: 02-11-2016, 03:00 AM by kaaai3.)

I am making an list where people can make a blog post active or inactive so i have to check if the status is active or not.
I have a table item called active in my database this is a boolean.

How would i achieve this  I have a begin of the view wether it displays an active post or inactive(this part works) but no clue how this would work in the controller or model.
I use font-awesome to display if the post is active or not

PHP Code:
<a href="<?php echo site_url('posts/activate/'. $post_item['id']); ?>">
 <?
php 
 
if($post_item['active'] == 1) {
 
 echo '<i class="fa fa-check-square-o fa-lg"></i>';
 } else {
 echo 
'<i class="fa fa-square-o fa-lg"></i>';
 }
 
?>
</a> 
Reply


Messages In This Thread
How do i check if table item is either true or false - by kaaai3 - 02-11-2016, 02:58 AM



Theme © iAndrew 2016 - Forum software by © MyBB