Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8935281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:57:25+00:00 2026-06-15T09:57:25+00:00

I am trying to use AES_DECRYPT in MySQL to decrypt a successfully encrypted SSN.

  • 0

I am trying to use AES_DECRYPT in MySQL to decrypt a successfully encrypted SSN. In the output I get the word “Array” instead of the actual data from that field. My PHP and MySQL knowledge is a bit rusty, so I’m sure it’s something silly I overlooked. Any help would be appreciated.

OUTPUT:
verify_name other_names ssn dob
: test : test : Array : test

CODE:

$key="88b871WZ3SntWK67rN3l2J1SvMqsOjyk";
$SQLstring = "SELECT * FROM applications";
$QueryResult = @mysql_query($SQLstring, $conn) or die("Query Problem - "
. mysql_error($conn) . " - Error Number - "
. mysql_errno($conn));
echo "verify_name other_names ssn dob";

$num_result = mysql_num_rows($QueryResult);
for ($i = 0; $i < $num_result; $i++)

{
$row = mysql_fetch_array($QueryResult);
$SQLstring2 = "SELECT AES_DECRYPT(ssn,'$key') FROM applications WHERE name='" . $row["name"] . "'";
$QueryResult2 = @mysql_query($SQLstring2, $conn) or die("Query Problem - "
. mysql_error($conn) . " - Error Number - "
. mysql_errno($conn));
$num_result2 = mysql_num_rows($QueryResult2);
for ($j = 0; $j < $num_result; $j++){
$ssndecrypt = mysql_fetch_array($QueryResult2);

echo $ssndecrypt[0];
}
echo $row["verify_name"];
echo $row["other_names"];
echo $ssndecrypt;
echo $row["dob"];

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T09:57:26+00:00Added an answer on June 15, 2026 at 9:57 am

    It’s because you’re fetching the result as an array.

    $ssndecrypt = mysql_fetch_array($QueryResult2);
    ...
    echo $ssndecrypt;
    

    It’s echoing Array because you never reassign the $ssndecrypt variable.

    The core of the problem, however, seems to be that you’re needlessly complicating your queries. There’s no reason to query the table twice when you can just do:

    SELECT verify_name,
           other_names,
           dob,
           AES_DECRYPT(ssn,'$key') AS ssn
      FROM applications
    

    This simplifies the code quite a bit:

    $stmt = "SELECT verify_name, other_names, dob, AES_DECRYPT(ssn,'$key') AS ssn FROM applications";
    $result = @mysql_query($stmt, $conn) or die("Query Problem - " . mysql_error($conn) . " - Error Number - " . mysql_errno($conn));
    echo "verify_name other_names ssn dob";
    while ($row = mysql_fetch_assoc($result))
    {
        echo $row["verify_name"];
        echo $row["other_names"];
        echo $row["ssn"];
        echo $row["dob"];
    }
    

    Ideally, though, you should be using PDO instead of the mysql_* functions:

    try {
        $dbh = new PDO('mysql:host=localhost;dbname=mydb', $user, $pass);
        foreach($dbh->query("SELECT verify_name, other_names, dob, AES_DECRYPT(ssn,'$key') AS ssn FROM applications") as $row) {
            echo $row["verify_name"];
            echo $row["other_names"];
            echo $row["ssn"];
            echo $row["dob"];
        }
        $dbh = null;
    } catch (PDOException $e) { die("ERROR: " . $e->getMessage()); }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use the following snippet to decrypt file, which was encrypted
I'm trying to use AES encryption ( AES_ENCRYPT in MySQL) for user passwords but
I was trying to use ggplot to plot monthly data that looks like this
I'm trying to use SealedObjects to send data over an RMI connection target is
I am trying to use geom_point to illustrate the count of my data. I
Ok I'm trying to use the Win32 Crypto API in C++ to decrypt a
I'm trying to encrypt some data from python (Google App Engine) and then decrypt
I'm trying to use a JavaScript library to encrypt data and send that to
i'm trying use facebook API to upload photo in my fan page. I downloaded
I am trying use gem tire to search in my application. I have tables

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.