ok heres my code:
<?php
include_once('dbconnect.php3'); // include database params & conn var
$query = "INSERT INTO `usercount` (Remote_IP, last_page, lastView) VALUES ('".$_SERVER['REMOTE_ADDR']."', '".$_SERVER['REQUEST_URI']."', NOW()) ON DUPLICATE UPDATE last_page='".$_SERVER['REQUEST_URI']."', lastView=NOW()";
$res = @mysql_query($query);
if(!$res){ echo mysql_error(); }
$oldest = 60*10; // Set to 10 minute maximum limit (60 seconds * 10 minutes)
$query = "SELECT count(id) AS active FROM `usercount` WHERE UNIX_TIMESTAMP(lastView)>UNIX_TIMESTAMP(NOW())-$oldest";
$res = mysql_query($query);
$users = mysql_result($res, 0, 'active');
?>
error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UPDATE last_page='/myphpwcms/index.php', lastView=NOW()' at line 1
any ideas?