开发者社区> 问答> 正文

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

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


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

    }
}

?>

展开
收起
社区秘书 2019-12-09 16:56:46 802 0
0 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
SQL Sever迁移PG经验 立即下载
低代码开发师(初级)实战教程 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载