php + mysql syntax

Discussion in 'PHP' started by ianlufc, Apr 29, 2008.

  1. #1
    guys and gals!

    im trying to retrieve data from a database...i encrypted some fields on INSERT using $key variable and that worked fine

    but having trouble selecting them with below sql
    $result = "SELECT aes_decrypt(name,'$key'), aes_DECRYPT(type,'$key'), aes_DECRYPT(number,'$key'), aes_DECRYPT(expiry_date,'$key'), date, trans, userN FROM `tab` WHERE trans= '$transNoForB'";

    its retrieving the data that has not been encrypted but not retrieving the encrypted data

    cheers
     
    ianlufc, Apr 29, 2008 IP
  2. ianlufc

    ianlufc Peon

    Messages:
    46
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    guys its half working now by doing putting AS after decrypts but two of the fields are still null......anyone no if there is any common problems with this

    $result = "SELECT aes_decrypt(name,'$key') as name, aes_DECRYPT(type,'$key') as type, aes_DECRYPT(number,'$key') as number, aes_DECRYPT(expiry_date,'$key') as expiry_date, date, trans, userN FROM `tab` WHERE trans= '$transNoForB'";
     
    ianlufc, Apr 29, 2008 IP