1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to perform AES encryption?

Discussion in 'Databases' started by rmmrj, Jul 30, 2013.

  1. #1
    Can anybody help me, how to implement AES encryption in PHP with MySQL?

    Thank you,
    Ramesh
     
    rmmrj, Jul 30, 2013 IP
  2. aamir777

    aamir777 Member

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #2
    Hello Ramesh

    You can do this like

    This is your string to encrypt and decrypt the data.
    $key = 'test123';

    To insert data in table
    $query = "INSERT INTO users (UserID, Password) VALUES (1, AES_ENCRYPT('password', '$key')";

    To retrieve data from table
    $query = "SELECT AES_DECRYPT(Password,'$key') AS Password FROM users WHERE UserID = 1";

    I hope this will help you.

    Regards

    Younas Aamir
     
    aamir777, Aug 17, 2013 IP
  3. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #3
    jestep, Aug 27, 2013 IP