Hey there, I have a really simple chat program that I made when I was bored. Anyway I am really tired of the meta refresh crap and I wanted to get a smooth ajax update sort of thing.

Here is my current code where exactly would I put the ajax refresh code? I have searched all over the internet just to get more confused.

Any help would be great!
Thank You.
- Kevin Neberman

HTML Code:
<?php require_once('../../Connections/AyalaPercussion07.php'); ?>
<?php
$colname_msgs = "-1";
if (isset($_GET['id'])) {
  $colname_msgs = (get_magic_quotes_gpc()) ? $_GET['id'] : addslashes($_GET['id']);
}
mysql_select_db($database_AyalaPercussion07, $AyalaPercussion07);
$query_msgs = sprintf("SELECT * FROM messenger_thred WHERE chatid = '%s' ORDER BY id DESC", $colname_msgs);
$msgs = mysql_query($query_msgs, $AyalaPercussion07) or die(mysql_error());
$row_msgs = mysql_fetch_assoc($msgs);
$totalRows_msgs = mysql_num_rows($msgs);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>
<style type="text/css">
<!--
body {
	background-color: #FFFFFF;
}
-->
</style>
<link href="../../other/css/admin2007.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
body,td,th {
	color: #000000;
}
-->
</style>
<script type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->
</script>
</head>

<body bottommargin="0" leftmargin="0" rightmargin="0" topmargin="0">
<?php do { ?>
    <?php if ($totalRows_msgs > 0) { // Show if recordset not empty ?>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td align="left"><div align="left"><span class="blacktextBOLD"><a href="#" target="_self" class="BOLD_active_link" onclick="MM_openBrWindow('../../aboutus/alumni.members/detail.php?id=<?php echo $row_msgs['userid']; ?>','','scrollbars=yes,width=800,height=700')"><?php echo $row_msgs['username']; ?></a></span><span class="blacktext">:</span> <span class="blacktextsmall"><?php echo $row_msgs['comment']; ?></span></div></td>
        </tr>
      </table>
      <?php } // Show if recordset not empty ?>
    <?php } while ($row_msgs = mysql_fetch_assoc($msgs)); ?>
<br />
<br />
<?php if ($totalRows_msgs == 0) { // Show if recordset empty ?>
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td align="center" class="blacktextBOLD"><div align="center">There are no messages in this chat. </div></td>
    </tr>
      </table>
  <?php } // Show if recordset empty ?></body>
  <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
  <script type="text/javascript">
_uacct = "UA-555570-1";
urchinTracker();
  </script>
</html>
<?php
mysql_free_result($msgs);
?>