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 Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.