所以,我一直在爲這個代碼整天奮戰。我已經嘗試了很多東西,無濟於事。爲此,我來這裏尋求答案。我的SQL語法錯誤
編輯:我修復了評論中提到的一些問題。然而,問題仍然存在。 錯誤是:
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
'values where `item_id` = 'Throne' ORDER BY `timestamp` DESC LIMIT 10'
at line 1
這是我的PHP代碼:
include("config.php");
include("functions.php");
if(isset($_GET['name'])){
$id = mysql_real_escape_string($_GET['name']);
$get_rares = mysql_query("SELECT * FROM rares WHERE `name` = '".$id."'") or die(mysql_error());
$rare = mysql_fetch_array($get_rares);
if(mysql_num_rows($check) == 0){
echo 'The rare '.$id.' doesn\'t exist!<br>';
}else{
$r = mysql_fetch_array($check);
$ids = $r["id"];
$name = $r["name"];
$value = $r["value"];
$lastedited = $r["lastedited"];
$catid = $r["catid"];
$desc = $r["desc"];
$image = $r["image"];
$big_image = $r["big_image"];
$release_value = $r["release_value"];
$releasedate = $r["releasedate"];
}
}else{
echo 'No rare has been selected to view.<br><br>Click <a href="members.php">here</a> to go to the rare list.';
}
?>
<?php $values = mysql_query("SELECT * FROM values where `item_id` = '".$id."' ORDER BY timestamp DESC LIMIT 10") or die(mysql_error());
關鍵字和錯誤是什麼? – Ryan
什麼是錯誤輸出? –
添加了錯誤輸出。我知道我忘了一些東西! – user2536680