Need Help on "DHTML and PHP"
| From: | kelvin | Date: | Thu, 15 Nov 2001 19:21:47 +0000 |
| Subject: | Need Help on "DHTML and PHP" | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-14370@lists.php.net to get a copy of this message | ||
Hi everyone,
I wrote a program which retrieved Username from DB every 2 or 4 second.
So, I used DHTML and PHP plus DB.
Well, I have to use DHTML because the user don't want to see the screen
flicker. Ok. Here is my program, but it didn't worked at all.
Could any one help me out please, I'll very appreicate.
Kelvin.
P.S ---- if you click on view source from browser after gen.
the code, it shown username on $toOut, but nothing display.
<html>
<body bgcolor="yellow">
<script>
function refresh()
{
time = new Date()
window.location='name.php3?tstamp='+escape(time);
}
<?
include("dedb.inc");
dedb_connect() or die(mysql_error());
$query="SELECT username FROM name ORDER BY username";
$result=mysql_query($query) or die(mysql_error());
while ($chat=mysql_fetch_array($result))
{
$username = $chat["username"];
$toOut = "<font
color='red'><b>".$username."></b></font>";
?>
username = '<? echo $toOut ?>';
if (document.all)
{
top.wOut.document.body.innerHTML+= username;
}
else
{ top.wOut.document.write("<html><style>BODY {font-family: Verdana,
sans-serif; color: #000055; font-size: 12px;} </style><body
bgcolor='#FFFFFF'>");
top.wOut.document.write(username);
}
<?
}
?>
setTimeout('refresh()',8000);
</script>
</html>