Jump to content

Active guests counts, parse error


markspec87

Recommended Posts

I have a piece of a code to count the active number of guests that looks like

[code]$minutes = 5;

$seconds = $minutes*60;


$past = time()-$seconds;


$now = time();


if ( @mysql_num_rows(mysql_query("SELECT * FROM visitors WHERE ip=$_SERVER[REMOTE_ADDR]")) != 0 ) {


mysql_query("UPDATE visitors SET date="$now" WHERE ip=$_SERVER[REMOTE_ADDR]") or die ("Error - Unable to update visit");


} else {

mysql_query("INSERT INTO visitors VALUES ($_SERVER[REMOTE_ADDR],"$now")") or die ("Error - Unable to insert records");

}

mysql_query("DELETE FROM visitors WHERE date < $past") or die ("Error - Unable to delete old visits");

$visitors = mysql_result(mysql_query("SELECT COUNT(*) FROM visitors"),0);
*/[/code]

However i get a parse error

[quote]Parse error: syntax error, unexpected T_VARIABLE in myfile on line 136[/quote]

Line 136 is the

[code]mysql_query("UPDATE visitors SET date="$now" WHERE ip=$_SERVER[REMOTE_ADDR]") or die ("Error - Unable to update visit");[/code]

any ideas guys?
Link to comment
https://forums.phpfreaks.com/topic/28659-active-guests-counts-parse-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.