Encode / Decode Problem
Posted: Mon Feb 24, 2003 2:57 pm
I'm trying to encode/decode some data, but I am apparently unable to decode it correctly.
One script uses some coding that can be simpliified like this:
mysql_query("UPDATE table SET data = ENCODE('the_data','a_password') WHERE something='something'");
Later, another script uses coding that can be simplified like this:
mysql_query("SELECT DECODE('the_data','a_password') AS data FROM table WHERE something='something'");
If I only ENCODE the data, and I don't DECODE it, my query returns a bunch of gibberish that is the same length as my original data (16 characters).
If I do DECODE the data, I get 9 characters of gibberish, but not the original 16 character data.
Any suggestions would be appreciated.
Mike Wilkinson
One script uses some coding that can be simpliified like this:
mysql_query("UPDATE table SET data = ENCODE('the_data','a_password') WHERE something='something'");
Later, another script uses coding that can be simplified like this:
mysql_query("SELECT DECODE('the_data','a_password') AS data FROM table WHERE something='something'");
If I only ENCODE the data, and I don't DECODE it, my query returns a bunch of gibberish that is the same length as my original data (16 characters).
If I do DECODE the data, I get 9 characters of gibberish, but not the original 16 character data.
Any suggestions would be appreciated.
Mike Wilkinson