So I am just doing a simple email verification for testing/learning purposes, however I cannot figure out what is wrong. Here is the problem:
The query works.. it updates the field in my table, but it should only do so if it active=0. So basically, it still echo's "success" even if active=1, which it should not be able to query, because its only supposed to grab WHERE active=0 ... this make sense? Here take a look
<?php
$connection = new mysqli('localhost', 'user', 'pass', 'db');
if (mysqli_connect_errno()) {
printf("Can't connect to MySQL Server. Errorcode: %s\n",
mysqli_connect_error());
exit;
}
$email = $_GET['email'];
$activation = $_GET['hash'];
$query = $connection->query("UPDATE users SET active = '1' WHERE
email='".$email."' AND activationCode='".$activation."' AND active='0'");
if ($query){
echo "success";
} else {
echo "fail";
}
$connection->close();
?>