$messages = $db->query("SELECT * FROM chatmessages ORDER BY datetime DESC, displayorderid DESC LIMIT 0,10");
while($message = $db->fetch_array($messages)) {
$oldMessage[] = $message['message'];
}
$oldMessages = array_reverse($oldMessages);
?>
<div id="chat">
<?php
for ($count = 0; $count < 9; $count++) {
echo $oldMessages[$count];
}
?>
<script language="javascript" type="text/javascript">
<!--
setInterval( "document.getElementById('chat').innerHTML='<NEW CONTENT OF #CHAT>'", 1000 );
-->
</script>
</div>
I'm attempting to develop a PHP chatroom script, but I'm encountering challenges in implementing AutoRefresh functionality.
The goal is to have the content update automatically. How can this be achieved? I've been researching for nearly an hour without success.