Hello I am trying to solve a problem. I've research and take time but unable to solve it sorry for that.
I am trying to show a database table query result in multiple table on a html page and every table should be a range i've put here 5 row at a table so if my query contain 29 row then it will show on 6 table and last table will contain 4 result the serial no of table will be correctly if first table 1st row is 01 then 2nd table 1st row will be 06. "the query result is not constant but it will depend on database record"
here is my code it shows only 1 table but not showing others table with result.
Thanks for your time. :)
$students = DB::table('mark_prc')
->select('student_roll','mark')
->where('cen_code', $c_code)
->where('sub_code',$subject)
->get();
$k=0; //counter for serial no
$m=5; // no of row each table
$c = count($students); // now have data on array after query 29
$p = ceil($c/5); // the data should be show on 6 tables now
for($i=0;$i<$p;$i++){
echo "<table>
<tr>
<th>SL</th>
<th>Roll</th>
<th>Mark</th>
</tr>";
for($j=$k;$j<$m;$j++){
echo '<tr>
<td>'.($k+1).'</td>
<td>'.$students[$k]->student_roll.'</td>
<td>'.$students[$k]->mark.'</td>
<tr>';
$k++;
}
echo '</table>';
}