So I'm using a free web hosting service to test my code out (which is a public messaging board) and when a message is sent to the database table from another computer, where every message is stored, the message can't be seen until I refresh the page. Is there a way to automatically refresh the table when the database table changes?
Here's the code I'm using to display the database table:
<?php
include_once "includes/database.php";
$sql = "SELECT * FROM board ORDER BY id DESC";
$result = mysqli_query($conn, $sql);
$resultCheck = mysqli_num_rows($result);
if ($resultCheck > 0) {
while ($row = mysqli_fetch_array($result)) {
echo "<tr>";
echo "<td>" . ($row['timstmp']) . "</td>";
echo "<td>" . ($row['user_id']) . "</td>";
echo "<td>" . ($row['message']) . "</td>";
echo "</tr>";
}
}
?>
here's a photo of the database table and here's a photo of the website.
I've tried automatically refreshing the page itself on a timer but that clears text fields that could be in use.