query($sql);
$row = $result->fetch_assoc();
*/
$sql = "SELECT email, unsubscribe, email_hash FROM sent_email WHERE email_hash = :email_id_hash ";
$q = $conn->prepare($sql);
$q->execute(array('email_id_hash'=>$email_id_hash));
while($data = $q->fetchAll(PDO::FETCH_ASSOC)) {
foreach($data as $row){
if($data != NULL){
if($row['unsubscribe'] == 0 && $row['email_hash'] == $email_id_hash){
/* $query="UPDATE sent_email SET unsubscribe = 1 WHERE email_hash ='". $email_id_hash."'";
$result = $conn->query($query);*/
$sql_up = "UPDATE sent_email SET unsubscribe = 1 WHERE email_hash =:email_id_hash ";
$q_up = $conn->prepare($sql_up);
$q_up->execute(array(':email_id_hash'=>$email_id_hash));
echo '
Thank You for unsubscription';
echo '
If you are not automatically redirected, click here: Fossee Laptop.';
}
elseif($row['unsubscribe'] == 1 && $row['email_hash'] == $email_id_hash){
echo '
You are already unsubscribed!';
echo '
If you are not automatically redirected, click here: Fossee Laptop.';
}
else{
echo '
You are not a subscriber!';
echo '
If you are not automatically redirected, click here: Fossee Laptop.';
}
}else{
echo "Wrong Link please try again";
}
}
}
}
$conn=null;
?>