Sql query error on phpmyadmin

Status
Not open for further replies.
Hi,

I am trying to run the following query in phpmyadmin.

SELECT * from tblregistration WHERE password = SHA1('a')

The exact same query runs without any issues in the mysql console (with the semi colon, ofcourse)

The error message is
"MySQL said: Documentation #1305 - FUNCTION test.sha1 does not exist"

Any suggestions/ideas?

Versions of apps running
phpMyAdmin 2.6.4-pl3
MySQL 5.0.15
PHP 5.0.5

Zeeshan Farooq
http://www.SilentDragons.com
[SD]www.dal.ca
 
Tried the suggestions. sorry did not work

Hi,

Thanks for the reply. I tried what you have suggested but unfortunately the sql excuted but did not give the desired result back.

If I do the same sql in mysql console it works just fine

mySql console

mysql> select * from tblregistration where password = SHA1('a');
+-------------+------------+-----------+------------------------------------------+
| email | first_name | last_name | password |
+-------------+------------+-----------+------------------------------------------+
| abc@abc.com | z | f | 86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 |
+-------------+------------+-----------+------------------------------------------+
1 row in set (0.00 sec)
 
Definitely the 'SHA1('a')' portion of the SQL statement is giving you problems.

Have you tried an escape character, like

select * from tblregistration where password = SHA1(''a'');
 
Tried Gary's suggestion as well

Hi,

Tried your sql statement and got the error
MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''' ) LIMIT 0, 30' at line 1

if i try

SELECT * from tblregistration WHERE password = sha1('a') in phpmyadmin i get the following error

#1305 - FUNCTION test.sha1 does not exist

Somehow PHP is thinking that the function SHA1 is a function of the "test" database.
========================
RealBlaclStuff

if you mean i should choose a "simple" password *smile* then I think you might have misunderstood me. what you see in the password field is the SHA1 of the letter "a" SHA1 hashes "a" into a 40 HEX digit string and returns that value.

I am still hopeful someone will come up with a solution and thanks to everyone who is trying to help I really appreciate it.
 
The current phpMyAdmin doesn't support the SHA1 MySQL fuction. The current CVS version has it though. You might want to upgrade - there's lots of other candy in there too.
 
Thanks a lot Nodsu

Hi Nodsu,

Thanks for the info. much appreciated.

So that in the future I don't repeat the same mistake how did you find out that the current version does not support SHA1. Is there any documentation? What part of the documentation would this be in?

Thanks again to everyone who helped.
 
I went to the phpMyAmin site and tried a query with SHA1() in the stable version demo getting the same error as you did. Then I did the same in the CVS demo and it worked. Then I looked at the phpMyAdmin changelogs and saw that SQL functions are features that are implemented one by one in phpMyAdmin and need to be specifically supported.
 
Status
Not open for further replies.
Back