Benim php sorguda bir hata mesajı alıyorum.
Error being displayed: 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 '1294251744','127.0.0.1','/register')' at line 2
benim kod:
<?php
require_once("includes/database.php");
//Set timeout to 5 minutes
$timeoutseconds = 300 ;
//get the time
$timestamp = time();
//Delete all users that are no online after the time out allowed
$timeout = $timestamp - $timeoutseconds ;
// stores users IP addresss
$user_ip = $_SERVER['REMOTE_ADDR'];
// Automatically collects the hostname or domain like example.com)
$host = $_SERVER['HTTP_HOST'];
$host_upper = strtoupper($host);
$path = rtrim(dirname($_SERVER['PHP_SELF']), '/');
//insert the values
$sql = "INSERT INTO totalonline(timestamp, ip, file)
VALUES (''$timestamp','$user_ip','$path')";
$result = mysql_query($sql, $conndb) or die(mysql_error());
//delete values when they leave
mysql_query("DELETE FROM totalonline WHERE timestamp < $timeout");
//grab the results
$sql = "SELECT DISTINCT ip FROM totalonline WHERE file='$path' ";
$result = mysql_query($sql, $conndb) or die(mysql_error());
//number of rows = the number of people online
$user = mysql_num_rows($result);
//spit out the results
if( $user == 1 ) {
echo "$user User online";
} else {
echo "$user User online";
}
?>