Reputation: 75
I have been searching and trying different ways for a while with no success.
What I need to do is to change the value in the DB TINYINT
column from 0 to 1 so as to check if an account has been verified.
Here is the snippet of code. The verify part works OK.
$query = "SELECT verify_code
FROM Member
WHERE verify_code = '$verify_code';";
$result = mysqli_query($conn, $query);
if(mysqli_num_rows($result) == 0) // Verfication code not found
{
die("No such code");
} else {
$sql = mysqli_query("UPDATE Verified SET Verified = 1 WHERE verify_code = $verfiy_code'");
header( "Location:TwitchMain.php");
}
Upvotes: 0
Views: 1580
Reputation: 311
The Column type is TINYINT , why you have to quote it ???
$query = "SELECT verify_code FROM Member WHERE verify_code = $verify_code ";
and then in your update query :
$update_query = "UPDATE Verified SET Verified = 1 WHERE verify_code = '$verfiy_code' ";
Upvotes: 0
Reputation: 46900
Not only did you miss the quote, you also used mysqli_query
in a wrong way, It needs a connection resource as the first parameter.
mysqli_query($conn,"UPDATE Member SET Verified = 1 WHERE verify_code = '$verify_code'");
Function Prototype
Procedural style
mixed mysqli_query ( mysqli $link , string $query [, int $resultmode = MYSQLI_STORE_RESULT ] )
Upvotes: 2