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

[eluser]Unknown[/eluser]
Hi. Recently I generated an array like this.

Code:
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
Code:
foreach($menu as $item)
. Therefore I tried to get
Code:
$data[$i]["menu"][...]
In the view but it just passes the fields not the array itself.

Thanks.




Theme © iAndrew 2016 - Forum software by © MyBB