I want to display dynamic data to HTML table row span,I'm fetching data from database, all the data is coming but I need to this dynamic data to HTML table format,below I given my HTML format and my php code please check and help I'm new in PHP.
In below Format I Need how to make:
cycle event dateassigned datecompleted
inventory 21-3-2022 22-3-2022
1 inspection 21-3-2022 22-3-2022
retest 21-3-2022 22-3-2022
repairtest 21-3-2022 22-3-2022
inventory 22-3-2022 22-3-2022
2 inspection 22-3-2022 22-3-2022
retest 22-3-2022 22-3-2022
repairtest 22-3-2022 22-3-2022
Query:
$query = "select bm.bridge_id, bm.status, bm.transaction_datetime,bm.review,bm.cycle,bm.event from bridge_details bm where bm.bridge_id = '$bridge_id'";
$res = mysqli_query($maindb_handle, $query) or die(__FUNCTION__." Query Failed ". "<br>($maindb_handle)<br>MySQL Error[".mysqli_error($maindb_handle)."]");
$row = mysqli_fetch_assoc($res);
if ($row['bridge_id'] == '') {
?>
<div align="center"><font color="red">Bridge Doesn't Existst - <?=$bridge_id?> </font></div>
<?php } else { ?>
<table border="2" align="center" width="80%">
<tr>
<th style="line-height:15px; font-size:15px; color:#984806; font-family:Arial Rounded MT Bold;"><b>Cycle</b></th>
<th style="line-height:15px; font-size:15px; color:#984806; font-family:Arial Rounded MT Bold;"><b>Type</b></th>
<th style="line-height:15px; font-size:15px; color:#984806; font-family:Arial Rounded MT Bold;"><b>Date Assined</b></th>
<th style="line-height:15px; font-size:15px; color:#984806; font-family:Arial Rounded MT Bold;"><b>Date Completed</b></th>
</tr>
<?php
echo '<tr>';
for ($i = 0; $i <=1; $i++){
echo '<td rowspan="4">'.$row['cycle'].'</td>';
echo '<td>'.$row['event'].'</td>';
echo '<td>'.$row['transaction_datetime'].'</td>';
echo '<td>'.$row['review'].'</td>';
}
echo '</tr>';
?>
</table>
<?php } ?>