In this piece of code, I am attempting to extract the email_address. For some reason, the code, that I expect to work does not yield the value of the email_address.
// GET THE EMAIL ADDRESS FROM THE ACTIVATION CODE
$sql = "SELECT email_address FROM userTable WHERE activate_code = '$safe_activate_code' LIMIT 1";
if (!$res = $mysqli->query($sql))
{
$err
= "QUERY FAIL: "
. $sql
. ' ERRNO: '
. $mysqli->errno
. ' ERROR: '
. $mysqli->error
;
trigger_error($err, E_USER_ERROR);
}
if ( $res->num_rows == 0 ) die("SORRY - YOUR ACTIVATION CODE WAS NOT FOUND");
// SET UP THE EMAIL ADDRESS HINT - billy@gmail.com HINTS bill? gmail com
echo "<br />num_rows = $res->num_rows" . PHP_EOL;
$row = mysql_fetch_assoc($res);
echo "<br />email_address = " . $row["email_address"] . PHP_EOL;
The result of the final num_rows is 1; But, the value for the email address is an empty string.
Why does $row["email_address"] not give me the email_address, which I know is not empty by inspecting the table for the activation code stored in the table for that email address.