Need some help here. I am trying to insert row value (email ids in this case), as a variable for further processing. The purpose is to decrypt the email ids which were saved encrypted and saved in the database. The code works fine on entering individual values (email ids) manually and it get decrypted fine. But it is not accepting results from the mysql query.
Here's the code.
<?php
include 'AES.php';
include 'db.php';
$input = $row;
$key = "key value";
$blockSize = 256;
$aes = new AES($input, $key, $blockSize);
$enc = $aes->encrypt();
$dec=$aes->decrypt();
$aes->setData($dec);
echo "Encrypted Value - ".$enc."<br/>";
echo "Decrypted Value - ".$dec."<br/>";
$sth = $pdo->prepare("SELECT email FROM tbl_subs");
$sth->execute();
print("<br>List of email IDs:\n <br><br>");
$result = $sth->fetchAll(\PDO::FETCH_ASSOC);
foreach( $result as $row ){
echo "<tr><td>";
echo $row['email'];
echo "</td><br>";
echo "</tr>";
}
?>
When I use $row or $result in input field ($input), it keeps on giving the error that $row or $result is not defined. How do I insert the result value in input field?
Regards, Anang