petroz Posted November 2, 2010 Share Posted November 2, 2010 Hey Guys, I am creating an array and I have a need to put a if statement inside it. Is this even possible? Here is where I am at so far, its just not working. function load_permissions($gid) { $data = array(); $this->db->select('`groups`.`name` AS `permission_name`, `permissions`.``'); $query = $this->db->get('`groups`,`permissions`'); if ($query->num_rows() > 0){ foreach ($query->result_array() as $row){ $data[] = array( "name" => $row['permission_name'], "read" => if($row['level'] >= 1) { img("img/true.gif") } else { img("img/false.gif") }, ); } } $query->free_result(); return $data; Thanks, Peter Link to comment https://forums.phpfreaks.com/topic/217523-if-statements/ Share on other sites More sharing options...
Jocka Posted November 2, 2010 Share Posted November 2, 2010 http://ca3.php.net/manual/en/function.eval.php Ur best bet on this. Link to comment https://forums.phpfreaks.com/topic/217523-if-statements/#findComment-1129298 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.