PHP and Mysql: base64_decode inside SELECT

Asked

Viewed 110 times

0

Hello,

I have an INSERT that registers in the bank with base64_encode(), working perfectly.

"INSERT INTO Atendimento_Campo_Prontuario (
                        acpr_id,
                        acpr_apro_id,
                        acpr_valor
                        )
                    VALUES (
                        :acprn_id,
                        :acprapro_id,
                        :acpr_valor)";
$p_sql->bindValue(':acpr_valor', base64_encode($acpr->getAcpr_valor()));

Now I need the base64_decode to get this information, someone can help me with this?

Would you have some way to pass base64_decode() inside SELECT like I do with acpr_id?

"SELECT * FROM  table WHERE table.acpr_id =:acpr_id";

$p_sql = Conexao::getInstance()->prepare($sql);
$p_sql->bindValue(':acpr_id', $acpr->getAcpr_id());

1 answer

0


In this case, before fetching the information in the database encrypt the variable, as well as in the.

Stop display the variable on the screen after fetching the result, decrypt it using

echo base64_decode($value);

  • Use base64_decode for each time you call the variable in the view?

  • use in the controller before sending to the view, but it would be the same thing

Browser other questions tagged

You are not signed in. Login or sign up in order to post.