所以,我整天都在与这个代码作斗争。我已经尝试了很多东西,但无济于事。为此,我来到这里寻求答案。
编辑:我修复了评论中提到的一些问题。然而,问题依然存在。错误是:
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());