I have a dynamic html table, in which I want the rows in the first column only to be merged together if the values are same.Image of table. In the first column, the first two row values are same, so they should be merged but the row values of third column should not be merged.
<table id="example1" class="table table-bordered">
<thead>
<th class="hidden"></th>
<th>Area</th>
<th>Name</th>
<th>Party</th>
<th>Symbol</th>
<th>Total Number of Votes</th>
</thead>
<tbody>
<?php
$query="SELECT * FROM `candidates` ";
$result=mysqli_query($con,$query);
while($row = mysqli_fetch_array($result)){
$sql1 = "SELECT `Name`,`Symbol` FROM `party` WHERE `Party_ID` = '".$row["Party_ID"]."' " ;
$query1 = $con->query($sql1);
$row1 = $query1->fetch_assoc();
$sql2 = "SELECT `Name` FROM `part` WHERE `Part_No` = '".$row["Part_No"]."' " ;
$query2 = $con->query($sql2);
$row2 = $query2->fetch_assoc();
$time1 = filemtime("../party/".$row['Symbol']);
echo "
<tr>
<td class='hidden'></td>
<td>".$row2['Name']."</td>
<td>".$row['Name']."</td>
<td>".$row1['Name']."</td>
<td><img src='../party/".$row1['Symbol']."?".$time1."' alt='".$row1['Symbol']."' role='button' width='30px' height='30px' onclick='window.open(this.src)'></td>
<td>".$row['Total_Votes']."</td>
</tr>
";
}
?>
</tbody>
</table>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…