Uncaught exception ‘PDOException’ with message ‘SQLSTATE[HY093]

my code :

    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 "

Confirmação de senha incorreta.

"; } }else{ return "

Email em uso.

"; } }else{ return "

Login em uso.

"; } }

fatal error: Fatal error: Uncaught exception ‘PDOException’ with message ‘SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens’ in C:AppServwwwclassCadastro.class.php:85 Stack trace: #0 C:AppServwwwclassCadastro.class.php(85): PDOStatement->execute() #1 C:AppServwwwcadastrarindex.php(7): Cadastro->registro(‘SkelletonX’, ‘SkelletonX’, ‘SkelletonX’, ‘SkelletonX@gmai…’, ‘SkelletonX’) #2 {main} thrown in C:AppServwwwclassCadastro.class.php on line 85


Source: stackoverflow-php

Leave a Reply

Your email address will not be published. Required fields are marked *