0

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 "<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>";

    }
}

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:\AppServ\www\class\Cadastro.class.php:85 Stack trace: #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...', 'SkelletonX') #2 {main} thrown in C:\AppServ\www\class\Cadastro.class.php on line 85

Guilherme
  • 107
  • 1
  • 1
  • 7

1 Answers1

0

You need to replace your query with

$rg = $conect->prepare("INSERT INTO account (login, Passwd, Email, Nick, Gamepoint)VALUES (?,?, ?, ?, ?);");
Ian
  • 3,539
  • 4
  • 27
  • 48