title: array looped through foreach not displaying any data
body: <p>I was working with an array which I have to list in a view page. so I iterated the array using a foreach loop. but it's not displaying any data and throwing an error like </p>
  
  <p><code>trying to get property of non-object</code> </p>
  
  <p>I have tried the normal way but didn't get it</p>
  
  <pre><code>&lt;div class="scrollbar1 table-content"&gt;
  &lt;?php
  foreach($items_list as $row)
  {
  ?&gt;
  &lt;div class="table-row"&gt;
  &lt;div class="row list_row_style color_black common_rows"&gt;
  
  &lt;div class="col-md-12 no_padding"&gt;
  &lt;a href="add_ledger_sub_type?ledger_name=&lt;?php echo $row-&gt;ledger_name; ? 
  &gt;"&gt;
  &lt;div class="row"&gt;
  &lt;div class="col-md-2   list_common_text_style table-data"&gt;
  &lt;?php echo $i; ?&gt;&lt;/div&gt;
  &lt;div class="col-md-3   list_common_text_style table-data" &gt;
  &lt;?php if(!empty($row-&gt;sub_ledger_name)) echo $row-&gt;sub_ledger_name; ?&gt;
  &lt;/div&gt;
  &lt;div class="col-md-3   list_common_text_style table-data" &gt;
  &lt;?php if(!empty($row-&gt;ledger_name)) echo $row-&gt;ledger_name; ?&gt;
  &lt;/div&gt;
  &lt;div class="col-md-4   list_common_text_style table-data" &gt;
  &lt;?php if(!empty($row-&gt;description)) echo $row-&gt;description; ?&gt;
  &lt;/div&gt;
  &lt;/div&gt;&lt;/a&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;?php
  $i++;
  }
  ?&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>My expected result is this code lists all items in '$items_list' array. But it's not</p>
  
  <p>Please help me.</p>