Your not closing off enough )'s

should look like this:
insert into payment (payname1,ccaccount) values
('Kinney',encode('5555444433332222','Ilwfci'));

Then, for decode, you do it like this:
SELECT DECODE(ccaccount,'Ilwfci') AS ccnumber FROM payment WHERE payname =
'Kinney';
----- Original Message -----
From: "Kinney Baughman" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 28, 2001 3:18 PM
Subject: What's the syntax for using ENCODE()?


> Hi,
>
> I'm trying to encrypt credit_card numbers in MySQL 3.23.33.  I want to
> decrypt them when I retrieve them.
>
> I've tried:
>
> mysql> insert into payment (payname1,ccaccount) values
> ("Kinney",encode('5555444433332222','Ilwfci');
> ERROR 1064: You have an error in your SQL syntax near '' at line 1
>
> mysql> insert into payment (payname1,ccaccount) values
> ("Kinney",encode(5555444433332222,Ilwfci);
> ERROR 1064: You have an error in your SQL syntax near 'Ilwfci)' at line 1
>
> mysql> insert into payment (payname1,ccaccount) values
> ("Kinney",ENCODE('5555444433332222',Ilwfci);
> ERROR 1064: You have an error in your SQL syntax near 'Ilwfci)' at line 1
>
> mysql> insert into payment (payname1,ccaccount) values
> ("Kinney",encode(5555444433332222,'Ilwfci');
> ERROR 1064: You have an error in your SQL syntax near '' at line 1
>
> I have "ccaccount" set up as a blob.
>
> As you can see, all I get is error messages.  What am I doing wrong?
>
> After I get them in, my next question is how to get them back out.
>
> According to the manual, one should use: DECODE(crypt_str,pass_str) where
> "crypt_str" should be a string returned from ENCODE().  This seems to be a
> catch-22, though.  Wouldn't I have to know the value of "crypt_str", i.e.
> the credit_card number in order to get that encrypted string out of
> ENCODE()?
>
> Thanks.
> --
> +-----------------------------------------------------------------------+
> | Kinney Baughman                          Appalachian State University |
> | Appalachian Regional Development Institute            Boone, NC 28608 |
> | Email:   [EMAIL PROTECTED]               Phone:  (828) 262-6523 |
> +-----------------------------------------------------------------------+
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>
>


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to