Re: [PHP] MySQL query problem!

2001-11-22 Thread David Robley

On Fri, 23 Nov 2001 17:05, De Necker Henri wrote:
>
> -Original Message-
> From: David Robley [mailto:[EMAIL PROTECTED]]
> 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")' )";

> On waht systems does encrypt() work on.In my Mysql client my query
> results are null,so i dont have encrypt on my system!

I doubt that crypt would exist on a Winblows box - you might have to use 
PASSWORD instead. However I'd hope to find it on a *nix system because 
that is what is used to encrypt the user passwords in *nix

-- 
David Robley  Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES  Flinders University, SOUTH AUSTRALIA  

   Never say, "Oops!"; always say, "Ah, interesting!"

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] MySQL query problem!

2001-11-22 Thread De Necker Henri

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:[EMAIL PROTECTED]]
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.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] MySQL query problem!

2001-11-22 Thread David Robley

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.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] MySQL query problem!

2001-11-22 Thread De Necker Henri

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?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP/mySQL query problem...

2001-08-27 Thread ERISEN, Mehmet Kamil

Yes, there is a problem.

--
SELECT * 
FROM links 
WHERE 1=1
and ( name LIKE "%te%" 
OR description LIKE "%te%" 
OR url LIKE "%te%" )
AND approved="1" LIMIT 5;
--


--- Jeff Lewis <[EMAIL PROTECTED]> wrote:
> Guys, why isn't this working? :)
> 
> SELECT * FROM links WHERE name LIKE "%te%" OR description
> LIKE "%te%" OR url LIKE "%te%" AND approved="1" LIMIT 5
> 
> I am using a PHP script to add items to the database and
> a small search file to grab them.  Thing is, I want the
> above to grab ONLY ones that have approved = 1.  In the
> database they are all = 0.  Is there a problem with my
> SQL query?
> 
> Jeff
> 


=
Mehmet Erisen
http://www.erisen.com

__
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] PHP/mySQL query problem...

2001-08-27 Thread Jeff Lewis

Guys, why isn't this working? :)

SELECT * FROM links WHERE name LIKE "%te%" OR description LIKE "%te%" OR url LIKE 
"%te%" AND approved="1" LIMIT 5

I am using a PHP script to add items to the database and a small search file to grab 
them.  Thing is, I want the above to grab ONLY ones that have approved = 1.  In the 
database they are all = 0.  Is there a problem with my SQL query?

Jeff