razta Posted May 21, 2009 Share Posted May 21, 2009 Hello, For some reason I cannot get MySQL to SELECT text... This works: SELECT * FROM `users` WHERE `user` = 1337 This doesnt: SELECT * FROM `users` WHERE `user` = admin The error I get when executing the second command is: #1054 - Unknown column 'admin' in 'where clause' However admin is there just like 1337 is. The column user is set to varchar(15). Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/159159-solved-can-not-select-text/ Share on other sites More sharing options...
Maq Posted May 21, 2009 Share Posted May 21, 2009 You should have your value in single quotes if the `user` field is a VARCHAR. SELECT * FROM `users` WHERE `user` = 'admin' Quote Link to comment https://forums.phpfreaks.com/topic/159159-solved-can-not-select-text/#findComment-839354 Share on other sites More sharing options...
razta Posted May 21, 2009 Author Share Posted May 21, 2009 Got it! :-\ SELECT * FROM `users` WHERE user = 'admin'; Thanks Maq Quote Link to comment https://forums.phpfreaks.com/topic/159159-solved-can-not-select-text/#findComment-839358 Share on other sites More sharing options...
Maq Posted May 21, 2009 Share Posted May 21, 2009 Got it! :-\ SELECT * FROM `users` WHERE user = 'admin'; Thanks Maq Good, I marked as solved for you. Next time there's a topic solved tab, bottom left. Quote Link to comment https://forums.phpfreaks.com/topic/159159-solved-can-not-select-text/#findComment-839364 Share on other sites More sharing options...
razta Posted May 21, 2009 Author Share Posted May 21, 2009 Thanks again! Quote Link to comment https://forums.phpfreaks.com/topic/159159-solved-can-not-select-text/#findComment-839374 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.