2014-04-13 136 views
-4

它说意外的“=”...我应该重写什么?由于MySQL查询语法错误

$result = mysql_query("SELECT * FROM soubory, users 
WHERE id='".$id."'" AND soubory.users_id = users.id); 
+1

是否语法高亮以上不送人? –

回答

3

删除第二个"$id."'

$result = mysql_query("SELECT * FROM soubory, users WHERE soubory.users_id='".$id."' AND soubory.users_id = users.id"); 
+0

它说 - >列'id'在where子句中是含糊的 但是当它只是没有和查询时,它很好。 – frky

+2

where子句中的列'id'是**不明确**,因为WHERE id是不明确的。试试'where users.id'或'where soubory.users_id' – ChoiZ

+1

@frky:你需要将'WHERE id ='交换到'WHERE users.id =',假设'id'是给用户的,而不是soubory。如果相反,使用另一个。 – halfer