Announcement

Collapse
No announcement yet.

Encrypting and decrypting

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Encrypting and decrypting

    I want to encrypt some data into a small string, like sessions do, and add it to the database. Then I want to retrieve it from the database and decrypt it and store the decrypted part in a variable

  • #2
    INSERT INTO table_name SET field_name=ENCODE('your string', 'encode_seed');

    SELECT DECODE(field_name, 'encode_seed') FROM table_name

    Comment


    • #3
      I tried that, it said it couldn't find the field when I tried to retrieve the date
      $result = mysql_query("SELECT DECODE(field_name, 'encode_seed') FROM table_name");
      $data=mysql_result($result,'','field_name');

      Comment


      • #4
        Whoops, I forgot... you need to give it a name.

        DECODE(field_name, 'encode_seed') AS field_name

        Comment

        widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
        Working...
        X