I am working on getting active users on a localhost server. While I came up with an error. I am providing the portion which is not working in PHP MySQL:
I changed $REMOTE_ADDR
, $PHP_SELF
to $_SERVER['$REMOTE_ADDR']
, $_SERVER['PHP_SELF']
as those are old version of PHP. Still not getting expected result.
$timestamp = time();
//insert the values
$insert = mysql_db_query($database, " INSERT INTO mytable VALUES('$timestamp', $_SERVER['$REMOTE_ADDR'], $_SERVER['PHP_SELF'] )" );
the error goes like this:
Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in G:\xampp\htdocs\jencyphp\liveonline\online.php on line 21