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
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]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.