警告:PDOStatement :: execute():SQLSTATE [HY093]:参数号无效:绑定变量数与令牌数不匹配

时间:2017-04-25 20:52:09

标签: php

我确实找不到错误,请帮我解决,它显示错误" PDOStatement :: execute():SQLSTATE [HY093]:参数号无效:绑定变量数与令牌数不匹配" ....

try{
      $con = new PDO ("mysql:host=localhost;dbname=oss","root","");{
       echo "connect"; 
      }


   if(isset($_POST['btnRegister'])) {
      $first_name = $_POST['first_name'];
      $last_name = $_POST['last_name'];

      $user_name = $_POST['user_name'];
      $email = $_POST['email'];
      $password = $_POST['password'];
      $passwordconf = $_POST['passwordconf'];
      $gender = $_POST['gender'];



       $insert= $con->prepare("INSERT INTO users (first_name,last_name,user_name,email,password,passwordconf,gender) values (:first_name,:last_name:user_name,:email,:password,:passwordconf,:gender)");
       $insert->bindParam(':first_name', $first_name);
       $insert->bindParam(':last_name', $last_name);
       $insert->bindParam(':user_name', $user_name);


       $insert->bindParam(':email', $email);

       $insert->bindParam(':password', $password);
       $insert->bindParam(':passwordconf', $passwordconf);
       $insert->bindParam(':gender', $gender);
        $insert->execute();
       echo "<script>alert('you have register Successfully');</script>";

  }

    }
   catch(PDOException $e)
{
   echo "error".$e->getmessage();
}

0 个答案:

没有答案