Try this syntax, it works for me

INSERT INTO users (name, password) VALUES ('$_POST[username]',

After VALUES, use
('variable', ENCRYPT('variable','key')

You've got it
which makes the second entry actually a variable that contains
"ENCODE($_POST[password], encrypt)"

When you try to decode that, you'll get gobble-di-gook!

Gary Every
Sr. UNIX Administrator
Ingram Entertainment
(615) 287-4876
"Pay It Forward"

-----Original Message-----
From: Lisi [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 24, 2002 3:11 PM
Subject: [PHP-DB] encode/decode

I am trying to use encode/decode to store passwords in a database and then 
retrieve it to email to a user who has forgotten their password.

I am using the following code to encode the password:
INSERT INTO users (name, password) VALUES ('$_POST[username]', 
'ENCODE($_POST[password], encrypt)')

This does enter a binary entry into the database, presumably the encoded

I then tried to retrieve the password using the following:
SELECT username, DECODE(password, 'encrypt') as password from users

but all I got was gobbledygook characters.

What am I doing wrong?



PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to