![]() |
Unknown column in 'field list'
Alright guys, I am totally 100% all and out stumped on this. It makes absolutely NO sense to me.
I have google'd quite a bit for a solution. I've come across many similar problems, the fixes range from adding different quotes, ticks, and as well as making sure the column doesn't have a space in its name. If I run the following query directly in phpMyAdmin : Code:
SELECT `salt` FROM `users` WHERE `username`='beezm';When I try running it from a script of my own, it errors out and gives me Code:
Unknown column 'salt' in 'field list'Aggghhhh!!! I am done for tonight, making this post and heading off to bed. Any suggestions would be GREATLY appreciated. Thanks guys. 8-) |
Show us the query that your PHP script is using.
|
Quote:
|
Sorry guys, but I'm a little confused as to what you need o_O.
Technically my script uses a more complex query , but I replace it with the same exact one I have listed above for testing purposes, and still manage to get the error. |
Quote:
Sometimes it takes another set of eyes to take a look.... |
Code:
mysql_query( "SELECT `salt` FROM `users` WHERE `username`='beezm';" , self::getLink() ) or die(mysql_error());It's making me want to bash my head in >.< lol I will go ahead and add.. This is technically part of a larger class that dynamically builds my query. But since I couldn't get it working, I've just gone all the way down to my actual mysql_query function to see what's going on. And that simple line above just won't work, it keeps spitting out the error I posted. But like I said, when I put the same query directly into phpMyAdmin it works fine. Next step is to make a stand alone script to try to same thing I guess :S But I just don't get it :( |
Quote:
mysql_query( "SELECT `salt` FROM `users` WHERE `username`='beezm'" , self::getLink() ) or die(mysql_error()); |
The error just says that MySQL can't see a column named "salt" in the "users" table. Are you 100% sure that your code is talking to the right database?
|
You know, I half thought about not replying to this thread, and just disappearing forever. Because I now realize how retarded I am and why I shouldn't code at 3 in the morning...
I am talking to the wrong database indeed. Thank you both very much. Salathe, ... *sigh* lol. Edit: I truly feel like an utter idiot :-D .. An elated utter idiot though. |
Quote:
Hey I've had that happen to me too before...it happens! |
Quote:
|
or twice :D
|
Try this:
Code:
SELECT `salt` FROM `users` WHERE `username` LIKE "beezm";Also, what version of mysql are you using? If you want to wildcard the mysql search query and find usernames that start with "bee" you'd add the wildcard (%) AFTER the match to be performed: Code:
SELECT `salt` FROM `users` WHERE `username` LIKE "bee%";Code:
SELECT `salt` FROM `users` WHERE `username` LIKE "%zm"; |
hello guys i have a same problem with him..i do not write code in mysql because im using mysql workbench.
Unknown column 'a_id' in 'field list' i had tat a_id on my dtabse i dont know how i fix this error.help me!! |
| All times are GMT. The time now is 01:01 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0