简体   繁体   中英

Unknown column in 'where clause?

I Have the following code of 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));

i tried every thing but it keep output me that following error "Unknown column in 'where clause ?" i tried to change the names of the columns and still the same problem

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

match(to_location.id) against(something)

I guess you may need to replace

WHERE match(to_location )

with

WHERE match(to_go.to_location)

Since you have a column name the same name as a table name, MySql is probably confusing them and thinking match(to_location) refers to the table. Try using the fully-qualified column name, ie, table_name.column_name .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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