MYSQL On Duplicate (Exclusion Clause?)
$update = '('.$site_id.',"'.$user_id.'","'.$online_ip.'",'.$time.')';
$sql_online = 'INSERT INTO `user_online` (site_id, user_id, online_ip, online_timestamp) VALUES '.$update.' ON DUPLICATE KEY UPDATE online_timestamp=VALUES(online_timestamp)';
online_ip - Primary Key
site_id - Unique Key
As you can see the above works well as a Users Currently Online, as every time the user visits a page it inserts their information, or updates the timestamp.
The problem I have is that two websites useing same database, with the difference site_id value.
Ive noticed that If i go to Site 1, then Site 2. Only Site 1 is visitor is counted.
Is their a way around this obstacle, a conditional clause on site_id ?