MySQL Forums
Forum List  »  Newbie

Re: Error 1054: Unknown column xxxx in WHERE clause..
Posted by: Russell Dyer
Date: June 25, 2005 07:40PM

I'm not exactly sure which API language you're using. However, I think my comments apply to any that this could be. The value in the WHERE clause should be in singe-quotes if it's a string. Otherwise, MySQL will assume the string it's passed is a column name and the table Usager probably won't have one by that name. I'm not sure what the point of the curly-braces are {}. You probably don't need them. So, your line of code should probably read like this:

$uneRequete = "SELECT * FROM Usager WHERE motDePasse = '$loginPassword'";

This should resolve the complaint about the unknown column. However, I suspect that you'll have another problem when you make that change. If the column motDePasse contains an encrypted password, you're going to have to use the same encryption method on the value of $loginPassword. That means that the line probably should look like this:

$uneRequete = "SELECT * FROM Usager WHERE motDePasse = PASSWORD('$loginPassword')";

Russell Dyer

Author of "MySQL in a Nutshell" (O'Reilly 2005).

Options: ReplyQuote


Subject
Written By
Posted
Re: Error 1054: Unknown column xxxx in WHERE clause..
June 25, 2005 07:40PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.