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
trying to get property of non-object
I have tried the normal way but didn't get it
<div class="scrollbar1 table-content">
<?php
foreach($items_list as $row)
{
?>
<div class="table-row">
<div class="row list_row_style color_black common_rows">
<div class="col-md-12 no_padding">
<a href="add_ledger_sub_type?ledger_name=<?php echo $row->ledger_name; ?
>">
<div class="row">
<div class="col-md-2 list_common_text_style table-data">
<?php echo $i; ?></div>
<div class="col-md-3 list_common_text_style table-data" >
<?php if(!empty($row->sub_ledger_name)) echo $row->sub_ledger_name; ?>
</div>
<div class="col-md-3 list_common_text_style table-data" >
<?php if(!empty($row->ledger_name)) echo $row->ledger_name; ?>
</div>
<div class="col-md-4 list_common_text_style table-data" >
<?php if(!empty($row->description)) echo $row->description; ?>
</div>
</div></a>
</div>
</div>
</div>
<?php
$i++;
}
?>
</div>
My expected result is this code lists all items in '$items_list' array. But it's not
Please help me.