i want to populate table that has first field static and other fields are coming from database using for loop
blank column are coming from database using for loop and i have to insert first column statically how do i do that?
for($i=0;$i<5;$i++){
<td></td>
<td></td>
<td></td>
<td></td>
}
i want these kind of result
story blank blank blank
games blank blank blank
number blank blank blank
I recommend you to read more about how to create a table and its rows (https://www.w3schools.com/html/html_tables.asp).
<?php for($i = 0; $i < 5; $i++):?>
<tr>
<td>my static value</td>
<td></td>
<td></td>
<td></td>
</tr>
<?php endfor;?>
Also, please keep those static values to an array and add them using the same for
.
<?php
$myArrayWithMyStaticValues = ['item1', 'item2', 'item3', 'item4', 'item5'];
for($i = 0; $i < 5; $i++):?>
<tr>
<td><?=$myArrayWithMyStaticValues[$i];?></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<?php endfor;?>
But be careful because you need to have the same number of items in your array as the for
condition.