Hello,
All of a sudden my boolean value changes in the database and I’m not exactly sure what’s going on. I’ve tried searching for this but the only thing that comes up is using auto-increment feature and that’s not what I want to happen.
Here’s a break down:
$id = strip_tags($_GET['id']);
$act = strip_tags($_GET['activation']);
if ($id && $act)
{
$query = mysqli_query($connect, "SELECT * FROM useraccounts WHERE userID = '$id' AND verification_code = '$act'");
$checkrow = mysqli_num_rows($query);
if ($checkrow == 1)
{
// run query
$set_activation = mysqli_query($connect, "UPDATE useraccounts SET activated = '1' AND userID = '$id'") or die(mysqli_error($connect));
echo "Your account has been verified. Please log in!";
}
else
die("Incomplete verification code. Please copy and paste if link is broken.");
}
else
die("Invalid verification data. Please submit support ticket or click the resend email link for a fresh validation code.");
The above code is a snippet from an email verification system I’m building and though everything works as it should, script side, anytime I test the verification process and I verify the email all other emails in the database switch back to zeros as though they were never verified and I know they were.
I’m using boolean value with - as defined: 0 for default (not selecting “as defined” doesn’t set the 0 as default) for a category labled “activated” which grants them access if the row contains 1 and no access if it contains 0.
I’m not sure what’s going on and was hoping one of you SQL gurus could point me in the right direction.
Additional Info:
The activated category is not set to unique - atleast it wasn’t when I added it.
Thanks in advance