繁体   English   中英

'where子句中的未知列?

[英]Unknown column in 'where clause?

我有以下PHP代码

        $query = sprintf("SELECT to_go.to_location FROM to_go 
                INNER JOIN to_location ON to_go.to_location_id = to_location.id 
                    WHERE match(to_location ) against(%s)", mysql_real_escape_string($location));

我尝试了所有的东西,但它继续输出我跟随错误“在where子句中的未知列?” 我试图改变列的名称,仍然是同样的问题

match(to_location ) against需要提供一个字段,而不是一个表:

match(to_location.id) against(something)

我想你可能需要更换

WHERE match(to_location )

WHERE match(to_go.to_location)

由于您的列名与表名相同,因此MySql可能match(to_location)它们混淆,并且思考match(to_location)指的是表。 尝试使用完全限定的列名,即table_name.column_name

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM