我被迫更新到 MySQL 5 和 PHP 5,因为我的服务提供商不再支持旧版本。我有一个运行良好的 MySQL 搜索工作站点。以下是放置在用户列表页面上的包含。当我取出 SQL 语句并在服务器上运行它时,它会返回正确的结果。我的猜测是它与格式化有关。任何想法为什么我可能会收到此错误?
“查询失败:您的 SQL 语法有错误;请查看与您的 MySQL 服务器版本相对应的手册,以在第 1 行的 'ORDER BY x.id_have LIMIT 0,30' 附近使用正确的语法”
使用这种语法
<table cellpadding="15" border="0">
<tr>
<td valign="top">
So far, the following members have these items which match;
<ul>
<?
$peoplewhomatch = mysql_query("SELECT x.id_customer, g.title Have, c.user_name as Member, g.title gwants, gg.title Has, y.id_customer x_username
FROM Want x
JOIN Want y
ON (y.id_sellversion,y.id_version) = (x.id_version,x.id_sellversion)
inner join Version as v
on x.id_version = v.id_version
inner join Version as vv
on y.id_version = vv.id_version
inner join Game as g
on g.id_game = vv.id_game
inner join Customer as c
on y.id_customer = c.id_customer
inner join Game as gg
on gg.id_game = v.id_game
WHERE x.id_have = $hid
ORDER BY x.id_have
LIMIT 0, 30")or die("Query failed: " . mysql_error());
while($row = mysql_fetch_array($peoplewhomatch))
{ ?>
<span class='greenitalic'><?=$row['Member']?></span> has <span class='highshadow'><?=$row['Has']?></span> and wants <span class='ishadow'><?=$row['gwants']?></span><BR><?}?>
</td>
</tr>
</table>