Read with Formatting | Join TechSpot! (it's free) | Bookmark / Share this



sql query error on phpmyadmin

zfarooq
11-14-2005, 11:49 PM
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

RealBlackStuff
11-15-2005, 03:21 AM
Is that ('a') part of the password? then make it password = "SHA1('a')"

Ad
11-15-2005, 03:21 AM

zfarooq
11-15-2005, 12:19 PM
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)

gary_hendricks
11-15-2005, 12:26 PM
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'');

RealBlackStuff
11-15-2005, 01:25 PM
Alternatively, get a more 'common' password. I've never seen anything as crazy as that!

zfarooq
11-15-2005, 01:51 PM
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.

Nodsu
11-15-2005, 02:24 PM
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.

zfarooq
11-15-2005, 04:05 PM
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.

Nodsu
11-16-2005, 04:19 AM
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.

RealBlackStuff
11-16-2005, 10:51 AM
See also this page:
http://dev.mysql.com/doc/refman/4.1/en/encryption-functions.html
scroll about 1/3 down.

I've worked with (IBM's DB2) SQL for nearly 20 years, but never came across this SHA1 stuff!

Ad
11-16-2005, 10:51 AM

 Top Technology News

 Software Downloads

Copyright © 1998-2008 TechSpot.com. TechSpot is a registered trademark. All Rights Reserved.