TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 03-26-2009, 08:16 AM   #1 (permalink)
WebDev'n Beer Drnkn' Fool
 
stewart's Avatar
 
Join Date: Dec 2007
Location: Denver, CO
Posts: 59
Thanks: 2
stewart is on a distinguished road
Angry 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';
It works fine. Returns my result.

When I try running it from a script of my own, it errors out and gives me
Code:
Unknown column 'salt' in 'field list'
Makes no sense. If my query was wrong, why does it run fine when I enter it manually ?!


Aggghhhh!!! I am done for tonight, making this post and heading off to bed. Any suggestions would be GREATLY appreciated.

Thanks guys.
__________________
stewart::howe
Web Developer & Programmer
CelerMedia.Com | iAmStewart.com | CelerLabs.com
Send a message via ICQ to stewart Send a message via AIM to stewart Send a message via MSN to stewart Send a message via Yahoo to stewart
stewart is offline  
Reply With Quote
Old 03-26-2009, 10:47 AM   #2 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

Show us the query that your PHP script is using.
Salathe is offline  
Reply With Quote
Old 03-26-2009, 02:05 PM   #3 (permalink)
The Gregarious
 
allworknoplay's Avatar
 
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
allworknoplay is on a distinguished road
Default

Quote:
Originally Posted by Salathe View Post
Show us the query that your PHP script is using.
Agreed, we're not mind readers!!!
allworknoplay is offline  
Reply With Quote
Old 03-26-2009, 03:48 PM   #4 (permalink)
WebDev'n Beer Drnkn' Fool
 
stewart's Avatar
 
Join Date: Dec 2007
Location: Denver, CO
Posts: 59
Thanks: 2
stewart is on a distinguished road
Default

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.
__________________
stewart::howe
Web Developer & Programmer
CelerMedia.Com | iAmStewart.com | CelerLabs.com
Send a message via ICQ to stewart Send a message via AIM to stewart Send a message via MSN to stewart Send a message via Yahoo to stewart
stewart is offline  
Reply With Quote
Old 03-26-2009, 04:43 PM   #5 (permalink)
The Gregarious
 
allworknoplay's Avatar
 
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
allworknoplay is on a distinguished road
Default

Quote:
Originally Posted by stewart View Post
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.
Well sometimes what you THINK you are writing in your script isn't what you are really coding...

Sometimes it takes another set of eyes to take a look....
allworknoplay is offline  
Reply With Quote
Old 03-26-2009, 05:09 PM   #6 (permalink)
WebDev'n Beer Drnkn' Fool
 
stewart's Avatar
 
Join Date: Dec 2007
Location: Denver, CO
Posts: 59
Thanks: 2
stewart is on a distinguished road
Default

Code:
mysql_query( "SELECT `salt` FROM `users` WHERE `username`='beezm';" , self::getLink() ) or die(mysql_error());
O_O

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 :(
__________________
stewart::howe
Web Developer & Programmer
CelerMedia.Com | iAmStewart.com | CelerLabs.com
Send a message via ICQ to stewart Send a message via AIM to stewart Send a message via MSN to stewart Send a message via Yahoo to stewart
stewart is offline  
Reply With Quote
Old 03-26-2009, 05:11 PM   #7 (permalink)
The Gregarious
 
allworknoplay's Avatar
 
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
allworknoplay is on a distinguished road
Default

Quote:
Originally Posted by stewart View Post
Code:
mysql_query( "SELECT `salt` FROM `users` WHERE `username`='beezm';" , self::getLink() ) or die(mysql_error());
O_O

It's making me want to bash my head in >.< lol
I don't think you're suppose to have a semi colon there in the select statement??


mysql_query( "SELECT `salt` FROM `users` WHERE `username`='beezm'" , self::getLink() ) or die(mysql_error());
allworknoplay is offline  
Reply With Quote
The Following User Says Thank You to allworknoplay For This Useful Post:
stewart (03-26-2009)
Old 03-26-2009, 05:27 PM   #8 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

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?
Salathe is offline  
Reply With Quote
The Following User Says Thank You to Salathe For This Useful Post:
stewart (03-26-2009)
Old 03-26-2009, 05:30 PM   #9 (permalink)
WebDev'n Beer Drnkn' Fool
 
stewart's Avatar
 
Join Date: Dec 2007
Location: Denver, CO
Posts: 59
Thanks: 2
stewart is on a distinguished road
Default

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 .. An elated utter idiot though.
__________________
stewart::howe
Web Developer & Programmer
CelerMedia.Com | iAmStewart.com | CelerLabs.com
Send a message via ICQ to stewart Send a message via AIM to stewart Send a message via MSN to stewart Send a message via Yahoo to stewart
stewart is offline  
Reply With Quote
Old 03-26-2009, 05:35 PM   #10 (permalink)
The Gregarious
 
allworknoplay's Avatar
 
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
allworknoplay is on a distinguished road
Default

Quote:
Originally Posted by stewart View Post
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 .. An elated utter idiot though.

Hey I've had that happen to me too before...it happens!
allworknoplay is offline  
Reply With Quote
Old 03-26-2009, 06:38 PM   #11 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

Quote:
Originally Posted by stewart View Post
Salathe, ... *sigh* lol.
Happens to us all, once.
Salathe is offline  
Reply With Quote
Old 03-27-2009, 05:47 PM   #12 (permalink)
The Contributor
 
Sakakuchi's Avatar
 
Join Date: Feb 2009
Posts: 64
Thanks: 1
Sakakuchi is on a distinguished road
Default

or twice :D
Sakakuchi is offline  
Reply With Quote
Old 04-01-2009, 12:51 PM   #13 (permalink)
The Contributor
 
WebSavvy's Avatar
 
Join Date: Mar 2009
Location: Springfield, IL USA
Posts: 75
Thanks: 3
WebSavvy is on a distinguished road
Default

Try this:

Code:
SELECT `salt` FROM `users` WHERE `username` LIKE "beezm";
If your mysql select statement uses double quotes, be sure to escape any other double quotes used within the select statement.

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%";
If you want to find usernames that end with "zm", you'd add the wildcard (%) BEFORE the match to be performed:

Code:
SELECT `salt` FROM `users` WHERE `username` LIKE "%zm";
hope this helps.
WebSavvy is offline  
Reply With Quote
Old 05-24-2012, 05:18 AM   #14 (permalink)
The Visitor
 
sophie's Avatar
 
Join Date: May 2012
Posts: 1
Thanks: 0
sophie is on a distinguished road
Default

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!!
sophie is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Status List codefreek TalkPHP Developer Team 12 11-24-2008 12:23 AM
writing field data into the url? sarmenhb Absolute Beginners 4 09-26-2008 03:01 AM
Refresh an input field delayedinsanity Javascript, AJAX, E4X 5 07-27-2008 07:48 AM
list populating proplem Peuplarchie Absolute Beginners 7 06-09-2008 09:02 AM
Comparing a timestamp field delayedinsanity MySQL & Databases 2 06-02-2008 09:49 PM


All times are GMT. The time now is 02:46 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design