I am trying to store data in a MySQL 4 table using aes. I can insert the data ok but any time I try to select it with aec_decrypt it returns null / blank. I have tried different data types, varchar, varbinary, text, blob, but nothing seems to work. Note that if I set it to binary, MySQL auto changes it to varbinary. If I set it to anything other then varbinary the data does not get inserted into the table. Note sure why that is. I am sure the aes password is correct. Here is an example of the query: SELECT AES_DECRYPT(password, 'AESPassword') FROM users WHERE uid='user' while($row = mysql_fetch_array($result)) { echo $row['password']; echo "<br />"; } Any thoughts on what I am missing?
Glad to hear that Note that if you want to use assoc you can do something like this: and than you echo $row['BLA']; aliases save you lot of typing, otherwise you have to echo $row['AES_DECRYPT(password, "AESPassword")'] because this is column name. Regards
A quick tip, if you are unsure what the array value is for a returned item, you can use: print_r($row); inside your while statement and it will show you the contents of the variable in its recursive format.