内连接和同一查询中返回空白错误mysql的位置

时间:2012-10-26 11:49:15

标签: php mysql mysql-error-1064

我遇到了一些问题。这是只返回空白页面的查询(我在php上尝试过错误报告等):

$query = mysql_query(" SELECT player.id, player.level, character.name, 
                              character.owner, character.owner 
                       FROM player 
                       INNER JOIN character ON player.id = character.owner
                       WHERE character.world  = '$world' ");

$res= mysql_fetch_array($query) or die(mysql_error);

2 个答案:

答案 0 :(得分:3)

mysql_error后你遗漏了括号,你应该在致电mysql_query后给它打电话:

$sql = "SELECT ...";
$result = mysql_query($sql) or die(mysql_error());

如果查询失败,则应显示错误消息。

有关如何正确使用mysql_query的更多详细信息,请参阅手册。

答案 1 :(得分:0)

$query = mysql_query(" SELECT player.id, player.level, character.name, 
                          character.owner, character.owner 
                   FROM player 
                   INNER JOIN character ON player.id = character.owner
                   WHERE character.world  = '$world' ") or die(mysql_error());

$res= mysql_fetch_array($query);

如果您错过了某些内容,这将显示您的错误。