Error: Query was empty

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

User avatar
ReverendDexter
Forum Contributor
Posts: 193
Joined: Tue May 29, 2007 1:26 pm
Location: Chico, CA

Post by ReverendDexter »

feyd wrote:
ReverendDexter wrote:And is it intentional that your variable is the column name instead of the value?
I'm pretty sure that is perfectly valid.
I agree, he may be trying to match known field values to a variable-specified column, which would be totally valid, however, testing on my system if I switch the order of column name and value, I get this:

Code: Select all

SELECT *
FROM cities
WHERE 'chico' = city
LIMIT 0 , 30 

Code: Select all

MySQL said:  
#1054 - Unknown column 'city' in 'where clause'
So I just wanted to make sure that what he was doing was intentional. :)
Post Reply