I want to display all rows in my database into my html table but it will not repeat the same data, how can I do this? please help me thanks. here is my table.
My table:
Here is my html and php code:
<?php
$result = mysqli_query($con, "SELECT * FROM turnoveritems");
if (mysqli_num_rows($result) > 0) {
?>
<table id="studentTable" class="display" border="2px">
<thead>
<tr>
<th>Reference #</th>
<th>Name</th>
<th>ACTION</th>
</tr>
</thead>
<?php
while ($row = mysqli_fetch_array($result)) {
echo "
<tr>
<td>" . $row["reference"] . "</td>
<td>" . $row["name"] . "</td>
<td class='text-center'>" . "<a href='viewturnover.php?name=" . $row['name'] . "'><i class='fa fa-eye fa-2x text-center' title='View full Details'></i></a> " ." </td>
</tr>";
} echo"</table>"; } else { echo"0 results";};
mysqli_close($con);
?>