I am having trouble on validating link for confirmation email. I can send users a confirmation link from my database as an HTML email like this
$msg = "
<a href=\"http://asite.ca/assets/functions/confirmation.php?key=$permissionCode\" target=\"_blank\">Click To Confirm</a>
";
the $permissionCode
is generating like this
$permissionCode = substr(md5(rand(1000, 9999999)), 0, 12);
which I inserted in confirm_code
field.
and in my confirmation.php I have
$key = $_Get["key"];
$sql = "SELECT * FROM `contact_request` WHERE `confirm_code` = $key";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
echo "We Will Contact You Soon";
} else {
echo "0 results";
}
but I am getting the 0 results
while the same code of the link is in the database when users click the confirmation link in their email! can you please let me know why this is happening?
Thanks