I have a for loop which runs upto 50 times. In my codeigniter view I have
Year Id
2015 1000001
2015 1000002
I have get database value using the following command
$data['get_data']=$this->get_data_model->getSeating();
I want to set the database value into sno, year, id in the view. But my database has only 2 columns.
<?php $i=1; if(@$get_data)
{
foreach($get_data as $row):
?>
<tr>
<td align="center" height="35"><?=$i?></td>
<td align="left"><?=$row->year?></td>
<td align="left"><?=$row->id?></td>
</tr>
<?php
$i++;
endforeach;
}
This will shows only 2 rows. Because my database has two values only. But I need to allocate 50 rows even if the data is not in database.
e.g In my example i want to show in my view
Normally it shows like this
Sno Year ID
1 2015 100001
2 2015 100002
But I want to show like this
Sno Year ID
1 2015 100001
2 2015 100002
3
4
5
......
50
forloop instead offoreach.forloop instead offoreachloop.. remember? ;)