why would't this work?
Posted: Fri Nov 01, 2002 8:09 am
Code: Select all
<?php
<?php
@mysql_connect('*****','*****','*****') or die ("error:
connecting db host..."); // db host
@mysql_select_db('clancek') or die ("Error: Connecting database...");
//database name
$timeoutseconds = 30; //time limit in secs before the old records are
deleted...
$timestamp = time();
$timeout = $timestamp-$timeoutseconds;
$remote = $HTTP_SERVER_VARSї"REMOTE_ADDR"];
$insert = mysql_query("INSERT INTO q_useronline VALUES
'timestamp','$remote')");
if(!($insert)) {
print "Useronline Insert Failed";
}
$delete = mysql_query("DELETE FROM q_useronline WHERE
timestamp<$timeout");
if(!($delete)) {
print "Useronline Delete Failed";
}
$result = mysql_query("SELECT DISTINCT ip FROM q_useronline");
if(!($result)) {
print "Useronline Select Error > ";
}
$user = mysql_num_rows($result);
if($user == 1) {
$online = "<b>Users Online:</b> $user\n";
} else {
$online = "<b>Users Online:</b> $user\n";
}
?>
?>error: Useronline Insert Failed
works great at localhost with php version 4.0.1, but it does't on the above host
thanks for your help.