Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php MySQL查询的语法错误_Php_Mysql_Sql - Fatal编程技术网

Php MySQL查询的语法错误

Php MySQL查询的语法错误,php,mysql,sql,Php,Mysql,Sql,上面写着意想不到的“=”。。。我应该重写什么?谢谢 $result = mysql_query("SELECT * FROM soubory, users WHERE id='".$id."'" AND soubory.users_id = users.id ); 删除$id.“之后的第二个”。“ 它表示where子句中的-->列“id”不明确,但如果它只是不带and和query,则表示该列不明确。where子句中的列“id”不明确,因为where id不明确。请尝试where users.i

上面写着意想不到的“=”。。。我应该重写什么?谢谢

$result = mysql_query("SELECT * FROM soubory, users
WHERE id='".$id."'" AND soubory.users_id = users.id );
删除
$id.“
之后的第二个
。“


它表示where子句中的-->列“id”不明确,但如果它只是不带and和query,则表示该列不明确。where子句中的列“id”不明确,因为
where id
不明确。请尝试
where users.id
where soubory.users\u id
@frky:您需要将
where id=
交换到
where users.id=
,假设
id
是为用户而不是soubory提供的。如果是另一种方式,请使用另一种方式。谢谢halfer,它可以工作:)@frky您可以使用
WHERE users.id
WHERE soubory.users\u id
喜欢答案。上面突出显示的语法不会泄露吗?
$result = mysql_query("SELECT * FROM soubory, users WHERE soubory.users_id='".$id."' AND soubory.users_id = users.id");