osos
osos

Reputation: 2133

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

Upvotes: 0

Views: 673

Answers (3)

SeanCannon
SeanCannon

Reputation: 77956

match(to_location ) against needs to be provided a field, not a table:

match(to_location.id) against(something)

Upvotes: 2

mellamokb
mellamokb

Reputation: 56769

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, i.e., table_name.column_name.

Upvotes: 0

Nanne
Nanne

Reputation: 64399

I guess you may need to replace

WHERE match(to_location )

with

WHERE match(to_go.to_location)

Upvotes: 0

Related Questions