I got this while loop that is displaying as you can see a username and a message which the user types... But after the message has been typed the user have to reload my page to see it. Is there a way to make the while loop execute while im on the site to keep it constantly updated?! like setting it to execute every second or something?
<?php
include "connect.php";
$query = "SELECT * FROM messages";
$result = $con->query($query);
if($result){
while($row = $result->fetch_object())
{
echo "<ul id = 'rutor'>";
echo '<li class = "userlada">'.$row->username. "</li>";
echo '<li class = "usertext">'.$row->message. "</li>";
echo "</ul>";
}
}
?>
I'm not the brigetest on php so any help would be great!:)