我的代碼:未捕獲的異常 'PDOException' 與消息 'SQLSTATE [HY093]
public function registro($login, $senha, $confsenha, $email, $nick){
$pw = strtoupper(md5($senha));
$pw2 = strtoupper(md5($confsenha));
if (!self::check_login($login)){
if(!self::check_email($email)){ //ok
if($pw == $pw2){
$conexao = new Config;
$conect = $conexao->getConn();
$rg = $conect->prepare("INSERT INTO account (login, Passwd, Email, Nick, Gamepoint)VALUES ('?', '?', '?', '?', ?);");
$rg->bindValue(1, $login);
$rg->bindValue(2, $pw);
$rg->bindValue(3, $email);
$rg->bindValue(4, $nick);
$rg->bindValue(5, 5000); //valor gamepoint
$rg->execute();
}else{
return "<div class='n_error'><p>Confirmação de senha incorreta.</p></div>";
}
}else{
return "<div class='n_error'><p>Email em uso.</p></div>";
}
}else{
return "<div class='n_error'><p>Login em uso.</p></div>";
}
}
致命錯誤:致命錯誤:未捕獲的異常 'PDOException' 與消息' SQLSTATE [HY093]:無效參數號:號碼的綁定變量不匹配C:\ AppServ \ www \ class \ Cadastro.class.php中的令牌數量:85堆棧跟蹤:#0 C:\ AppServ \ www \ class \ Cadastro.class.php(85):PDOStatement - > execute()#1 C:\ AppServ \ www \ cadastrar \ index.php(7):Cadastro-> registro('SkelletonX','SkelletonX','SkelletonX','SkelletonX @ gmai ...','在線85上的C:\ AppServ \ www \ class \ Cadastro.class.php中拋出#2 {main}
請勿在查詢中使用引號''''。這使他們文字,而不是佔位符。 – Barmar