PDO错误:试图绑定参数号65536。SQLServer支持最多2100个参数

时间:2019-12-09 02:39:19

标签: php sql pdo

基于我上面的问题。我不知道为什么会发生此错误。当我将PHP文件放入XAMPP时,一切正常。但是,当我将其放置到SQL Server时,就会出现此错误。当我想向数据库中插入数据时发生此错误。下面是我的代码:

<?php

require_once "../../../config/configPDO.php";
require_once "../../../config/check.php";

if(isset($_POST['Submit']))
{
  //Getting Post Values
  $engineer_badgeid = $_POST['engineer_badgeid'];
  // Query for validation of username and email-id
  $ret="SELECT * FROM team where (engineer_badgeid=:engineer_badgeid)";
  $queryt = $conn -> prepare($ret);
  $queryt->bindParam(':engineer_badgeid',$engineer_badgeid,PDO::PARAM_STR);
  $queryt -> execute();
  $results = $queryt -> fetchAll(PDO::FETCH_OBJ);

  if($queryt -> rowCount() == 0)
      {
      $sql="INSERT INTO team (team_name, engineer_badgeid) SELECT fullname, badgeid FROM users WHERE users.badgeid = '$engineer_badgeid'";
      $query = $conn->prepare($sql);
      // Binding Post Values
      $query->bindParam('engineer_badgeid', $engineer_badgeid);
      $query->execute();


          if($query->rowCount() > 0 ){

            header("Location:team.php");

          }else{
            echo "
            <script>alert('Something wrong, please try again')</script>
            <script>window.location = 'team.php'</script>
            ";

          }
        }
else{

  echo "
  <script>alert('The team you want to add is already exist')</script>
  <script>window.location = 'team.php'</script>
  ";

    }
}

?>

0 个答案:

没有答案
相关问题