Jump to content

Multiple AES_DECRYPT in mysql


ramli

Recommended Posts

I want to select multiple mysql encryted and non-encrypted values and decrypt them for usage:

[code]

$Query = mysql_query("SELECT AES_DECRYPT(adres,'$key'), AES_DECRYPT(zipcode,'$key'), * FROM
userspersonal WHERE ID ='$relationid'");

while($r = mysql_fetch_array($Query))
{
$adresdb = $r['adres'];
echo($adresdb);
}

[/code]

As you can see i want to select two values and decrypt them and then i want to select the remaining fields in de table. Then i use mysql_fetch_array to put them i a array.

I dont seem to get it to work, any help pleace ?



Link to comment
https://forums.phpfreaks.com/topic/36225-multiple-aes_decrypt-in-mysql/
Share on other sites

Yeah you just can't use * when you have other fields listed. Do this:
[code]
$Query = mysql_query("SELECT AES_DECRYPT(adres,'$key'), AES_DECRYPT(zipcode,'$key'), up.* FROM
userspersonal AS up WHERE ID ='$relationid'");

while($r = mysql_fetch_array($Query))
{
$adresdb = $r['adres'];
echo($adresdb);
}[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.