blunerve09 Posted July 31, 2007 Share Posted July 31, 2007 I'm using the below statement to search the database for a specific city. The same exact statement works when I search the database for the zip code. SELECT name, email FROM table WHERE city LIKE leesburg Every time I run this query, I get an error that says: Unknown column 'leesburg' in 'where clause' Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/62721-solved-unknown-column-in-where-clause/ Share on other sites More sharing options...
isaac_cm Posted July 31, 2007 Share Posted July 31, 2007 maybe because zip code is a numeric field and city is a varchar field so you better use "" like this SELECT name, email FROM table WHERE city LIKE "leesburg" Quote Link to comment https://forums.phpfreaks.com/topic/62721-solved-unknown-column-in-where-clause/#findComment-312193 Share on other sites More sharing options...
Wildbug Posted July 31, 2007 Share Posted July 31, 2007 Issac's right; "leesburg" is a string, not a number. Also, if you're not using any wildcards with LIKE, why not use equals (=) for reasons of efficiency? Quote Link to comment https://forums.phpfreaks.com/topic/62721-solved-unknown-column-in-where-clause/#findComment-312197 Share on other sites More sharing options...
blunerve09 Posted July 31, 2007 Author Share Posted July 31, 2007 thanks, that made it work. I appreciate your help Quote Link to comment https://forums.phpfreaks.com/topic/62721-solved-unknown-column-in-where-clause/#findComment-312209 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.