I am using the setTimeout() function to reload a javascript function. I then start php up to get new messages from the database. I finally got it to display the text but that is it. It doesn’t output any of the other information. Here is my code.
[code=php]
<?PHP
error_reporting(E_ALL^E_NOTICE);
mysql_connect(“localhost”);
mysql_select_db(“maddChatter”);
?>
<html>
<head>
<title>maddChatter 1.0</title>
<link href=”style.css” rel=”stylesheet” type=”text/css”>
</head>
<body style=”background-color: transparent;” onLoad=”refresh();”>
<div id=”messages”>
<script type=”text/javascript”>
function refresh() {
<?PHP
$getmessages=mysql_query(“SELECT * from messages order by messageId desc”);
echo mysql_error();
while($a=mysql_fetch_array($getmessages)) {
//GET USER NAMES
$getusers=mysql_query(“SELECT * from users where userId=’$a[userId]'”);
$b=mysql_fetch_array($getusers);
echo mysql_error();
if($a[userId]==Notice) {
echo “document.writeln(‘<strong style=”color: #333333;”>Notice:</strong> $a[message]<br>’)”;
}else { echo “document.writeln(‘<strong style=”color: #333333;”>$b[userName]:</strong> $a[message]<br>’)”; }
//echo “alert(“$b[userName]: $a[message]”); “;
}
?>
setTimeout(“refresh()”, 4000); }
</script>
</div>
</body>
</html>
Thanks,
[url]www.maddDidley.com