I have 1 array data may also be more and want to present it on the table, I tried to make the default table by 5 column, but when I try the same result 5 column all its data. should have 3 column 2 column is empty, what is lacking in my script?
This myscript
<?php
$no = 1;
for($x=1; $x<=5; $x++) {
foreach ($mydata as $row) {
echo '<tr>';
echo '<td>'.$no.'</td>';
echo '<td>'.$row->id.'</td>';
echo '<td>'.$row->name.'</td>';
echo '<td>'.$row->class.'</td>';
echo '</tr>';
$no++;
}
}
?>
the results of the script
NO | ID | NAME | ClASS |
____|____ |______|_______|
1 | 001 | Paul | x |
2 | 001 | Paul | x |
3 | 001 | Paul | x |
4 | 001 | Paul | x |
5 | 001 | Paul | x |
I expected
NO | ID | NAME | ClASS |
____|____ |______|_______|
1 | 001 | Paul | x |
2 | | | |
3 | | | |
4 | | | |
5 | | | |