decrypted value from mysql pdo php -


$stmt2 = $dbh-> prepare("select * encryptme ".decrypt('encryptedcolumn', $key)." = ?"); $stmt2 -> bindvalue(1, $dec, pdo::param_str); $stmt2 -> execute(); 

i have encrypt() , decrypt() save data after using encrypt() want select data not able because data encrypted. tried used function in column name not working error saying

uncaught exception 'pdoexception' message 'sqlstate[42000]: syntax error or access violation: 1064 have error in sql syntax; check manual corresponds mysql server version right syntax use near '= '

how can decrypt column in query statement?

you can not use php function decrypt value in database while querying. (you can use database function if supports entcryption method however)

you can instead send encrypted parameter database compare encrypted stored value.

after fetching data can decrypt value whatever need to.

edit after new information:

if can not reliably encrypt values in php, have fetch data database , decrypt can compare values.


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -