also @ TechSpot: Fair Labor Association begins inspections of Foxconn at Apple's request
Welcome to the TechSpot OpenBoards. Please read the FAQ if you have any questions. Sign up or Login to participate.

Go Back   TechSpot OpenBoards > Software > The Alternative OS

Collaborate in the cloud with Office, Exchange, SharePoint, and Lync

sql query error on phpmyadmin

Thread Tools Search this Thread
  #1  
Old 11-14-2005
Newcomer, in training
 
Member since: Nov 2005, 4 posts
sql query error on phpmyadmin

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
  #2  
Old 11-15-2005
TechSpot Evangelist
 
Location: has left the building
Member since: Aug 2003, 8,165 posts
Is that ('a') part of the password? then make it password = "SHA1('a')"
  #3  
Old 11-15-2005
Newcomer, in training
 
Member since: Nov 2005, 4 posts
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)
  #4  
Old 11-15-2005
gary_hendricks's Avatar
TechSpot Member
 
Location: Singapore
Member since: Nov 2005, 138 posts
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'');
  #5  
Old 11-15-2005
TechSpot Evangelist
 
Location: has left the building
Member since: Aug 2003, 8,165 posts
Alternatively, get a more 'common' password. I've never seen anything as crazy as that!
  #6  
Old 11-15-2005
Newcomer, in training
 
Member since: Nov 2005, 4 posts
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.
  #7  
Old 11-15-2005
Nodsu's Avatar
TechSpot Evangelist
 
Location: Estonia
Member since: Feb 2002, 9,431 posts
System specs
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.

Last edited by Nodsu; 11-15-2005 at 02:26 PM..
  #8  
Old 11-15-2005
Newcomer, in training
 
Member since: Nov 2005, 4 posts
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.
  #9  
Old 11-16-2005
Nodsu's Avatar
TechSpot Evangelist
 
Location: Estonia
Member since: Feb 2002, 9,431 posts
System specs
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.
  #10  
Old 11-16-2005
TechSpot Evangelist
 
Location: has left the building
Member since: Aug 2003, 8,165 posts
See also this page:
http://dev.mysql.com/doc/refman/4.1/...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!
Closed Thread

Similar Topics
Topic Replies Forum
I am having trouble logging out of phpMyAdmin 3.0.1.1 1 Windows OS
Query MBR error, USB HD not seen. 3 Windows OS
HELP! with PhpMyAdmin 5 The Alternative OS
phpMyAdmin help! 3 The Alternative OS
Error Report: Query registry content failed. 2 Windows OS

Thread Tools Search this Thread
Search this Thread:

Advanced Search
All times are GMT -4. The time now is 04:23 AM.