RE: [PHP] MySQL query problem!

From: Date: Fri, 23 Nov 2001 06:35:57 +0000
Subject: RE: [PHP] MySQL query problem!
Groups: php.general 
Request: Send a blank email to php-general+get-75562@lists.php.net to get a copy of this message
On waht systems does encrypt() work on.In my Mysql client my query results are null,so i dont have encrypt on my system! -----Original Message----- From: David Robley [mailto:huntsman@www.nisu.flinders.edu.au] Sent: 23 November 2001 08:24 To: De Necker Henri; PHP-General (E-mail) Subject: Re: [PHP] MySQL query problem! On Fri, 23 Nov 2001 16:17, De Necker Henri wrote: > I have the following query > $query = "INSERT INTO acl ( username, password ) > VALUES ( 'henri', ENCRYPT('diesel','henri') )"; > > This is the error i get : > Column 'password' cannot be null > What is wrong with my query? Mysql docs say: ENCRYPT(str[,salt]) Encrypt str using the Unix crypt() system call. The salt argument should be a string with two characters. (As of MySQL Version 3.22.16, salt may be longer than two characters.): mysql> select ENCRYPT("hello"); -> 'VxuFAJXVARROc' If crypt() is not available on your system, ENCRYPT() always returns NULL. ENCRYPT() ignores all but the rst 8 characters of str, at least on some systems. This will be determined by the behavior of the underlying crypt() system call. ##### It may be that you don't have crypt on your system; also, you might want single quotes around the ENCRYPT and double quotes to delimit the string and salt, thus: VALUES ( 'henri', 'ENCRYPT("diesel","henri")' )"; -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA " ," said Tom blankly.

« previous php.general (#75562) next »