0

一段时间以来,我一直在寻找和尝试不同的方法,但没有成功。

我需要做的是将 DBTINYINT列中的值从 0 更改为 1,以检查帐户是否已通过验证。

这是代码片段。验证部分工作正常。

$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");
}
4

2 回答 2

2

不仅错过了报价,还用mysqli_query错了方式,它需要一个连接资源作为第一个参数。

mysqli_query($conn,"UPDATE Member SET Verified = 1 WHERE verify_code = '$verify_code'");

函数原型

程序风格

mixed mysqli_query ( mysqli $link , string $query [, int $resultmode = MYSQLI_STORE_RESULT ] )

参考

于 2013-10-28T07:24:31.453 回答
0

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' ";
于 2013-10-28T07:32:15.820 回答