Hi,
I'm driving myself mad here, I've written a login script which isn't working so I thought I'll go into my PHPmyAdmin and use the client. My email and username return no results using this query:
[syntax=sql]
SELECT id, firstName
FROM users
WHERE (`email` = 'myemail@example.com' AND `password`= '544sd4a5d4as5d4fsd4f') // This a long hash
[/syntax]
The query doesn't fail it just returns no records and i'm using the values already stored in the DB. If i just search for a column that isn't the password column it returns the information. But as soon as I involve the password column in a combination WHERE or on its own it fails. And I'm copying and pasting the value from the database.
What am I dong wrong?
MYSQL client
Re: MYSQL client
Hmm, it looks okay overall. The only thing I can think of is that id is a mysql keywords, so try wrapping all of the column and table names in backticks. I tend to do this any way just to avoid there being any problems.
Re: MYSQL client
Yeah I did try that, same result. I don't know whether to be pleased that i'm not going mad or disappointed that it isn't just an oversight. I don't see what's wrong with the pword column :S
Re: MYSQL client
Maybe try it without the brackets then, since they usually indicate a sub-query
[syntax=sql]SELECT
`id`,
`firstName`
FROM `users`
WHERE `email` = 'myemail@example.com'
AND `password`= '544sd4a5d4as5d4fsd4f'[/syntax]
??
[syntax=sql]SELECT
`id`,
`firstName`
FROM `users`
WHERE `email` = 'myemail@example.com'
AND `password`= '544sd4a5d4as5d4fsd4f'[/syntax]
??
Re: MYSQL client
Hmm, still the same, I'm at a loss.
This is as simple I can make the query and it still fails
[syntax=sql]
SELECT `firstName` FROM `users` WHERE `password` = '544sd4a5d4as5d4fsd4f'
[/syntax]
This is as simple I can make the query and it still fails
[syntax=sql]
SELECT `firstName` FROM `users` WHERE `password` = '544sd4a5d4as5d4fsd4f'
[/syntax]
Re: MYSQL client
Right,
Are you sure the password in the table is the same ? Check to make sure it does not have a space or somethign after it.
Are you sure the password in the table is the same ? Check to make sure it does not have a space or somethign after it.
Re: MYSQL client
I think it might have been because i'm storing the password in binary so that's why the client didn't return the row when using the password value. Not sure though, thanks for the help.