I'm using MCRYPT to encrypt sensitive data and save them to the database. The encrypted data look like this (non-encrypted data above the encrypted data)
then insert to the MySQL PDO database as usual in a text field utf8_unicode_ci but the result is empty most of the times. Sometimes it saves only the first character. So how to save the encrypted value into the database?
$stmt=$db->prepare("insert into TABLE (myData) VALUES (:enc) ");
$stmt->bindParam(':enc',$encrypted);
$stmt->execute();
additionally encode base64
encode after encryption
and decode before decryption