私のPHPクエリでエラーメッセージが表示されます。私のPHPクエリでエラーが発生する
エラーが表示されます: SQL構文にエラーがあります。ラインに近い「1294251744」、「127.0.0.1」、「)「/登録」を使用する権利構文についてはMySQLサーバのバージョンに対応するマニュアルを確認してください2
私のコード:
<?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";
}
?>
//値を挿入してください $ sql = "INSERT INTO totalonline(タイムスタンプ、IP、ファイル) VALUES( '' $ timestamp '、' $ user_ip '、' $ path ')"; タイムスタンプの前に余分な引用符があります。 – fiunchinho
"私のPHPクエリでエラーメッセージが表示されています。"、ok。それについてもっと情報を共有したいのですか、それとも泣かなければなりませんか?私は彼の背景、答え、質問を検索し、人々が彼をどれほど憎んでいるのかは驚くほどです。3,2,2,3でフラグを付ける。 – Shoe
だから私はこの質問にフラグを立てた。 – Shoe