Welcome Guest, Not a member yet? Register   Sign In
Problem with fetching array to view

Hi. Recently I generated an array like this.

private function _getMenuBar(){
    $data = array();
    $query = $this->db->query("SELECT * FROM df_menubar_table WHERE visible = 1 AND parent = -1 ORDER BY priority");
    foreach($query->result_array() as $row){
      $data[count($data)] = array(
        "menu" => array(
          "title" => $row['title'],
          "url" => $row['url'],
          "name" => $row['name'],
          "selected" => 0
    return $data;

But there is a problem. If I pass the result to a view I need to have access to a type not a numeric identifier. Cuz in this way my array would be -> array(0) = ... And I cant use
foreach($menu as $item)
. Therefore I tried to get
In the view but it just passes the fields not the array itself.


Theme © iAndrew 2016 - Forum software by © MyBB