我正在尝试用PDO进行更新声明,我发现它不起作用。
我已经在phpMyadmin中测试了SQL语句,如果我把密码放在“密码”旁边,它会起作用,但为什么不能使用它呢?
信息: 密钥是md5字符串
<?php
include('../mysql/pdoconn.php');
$passkey = $_GET['passkey'];
$stmt = $conn->prepare("UPDATE user SET com_code='' WHERE com_code = :passkey");
$stmt->bindParam(':passkey', $passkey , PDO::PARAM_STR);
$stmt->execute;
$error = "Jon Snow";
$stmt1 = $conn->prepare("SELECT com_code from user where com_code =''");
$stmt1->execute;
$result = $stmt1->fetchColumn();
if($result === "")
{
$error = 'Your account is now active. You may now <a href="../signin/sign.php">Log in</a>';
$conn = null;
} else
{
$error = $passkey;
$conn = null;
}
?>
我已经测试过它获得了密钥,而且确实如此,但是它没有更新表...
我尝试了任何东西,但我无法让它工作
答案 0 :(得分:2)
$stmt = $conn->prepare("UPDATE user SET com_code='' WHERE com_code = :passkey");
$stmt->bindParam(':passkey', $passkey , PDO::PARAM_STR);
$stmt->execute();
execute()
是一个功能