Php 查询失败:SQLSTATE[HY093]:参数编号无效:绑定变量的数量与令牌的数量不匹配

Php 查询失败:SQLSTATE[HY093]:参数编号无效:绑定变量的数量与令牌的数量不匹配,php,pdo,Php,Pdo,我正在使用PDO并更新数据库中的多个表。每次执行查询时,我都会收到以下错误: 查询失败:SQLSTATE[HY093]:参数编号无效:绑定变量的数量与令牌的数量不匹配 我已经检查过了,似乎是正确的。我可以使用硬值在PHPMyAdmin中运行查询,它将更新表。我已经为测试硬编码了表名 $conn = parent::connect(); $sql = "UPDATE ds_employee LEFT

我正在使用PDO并更新数据库中的多个表。每次执行查询时,我都会收到以下错误:

查询失败:SQLSTATE[HY093]:参数编号无效:绑定变量的数量与令牌的数量不匹配

我已经检查过了,似乎是正确的。我可以使用硬值在PHPMyAdmin中运行查询,它将更新表。我已经为测试硬编码了表名

                $conn = parent::connect();
            $sql = "UPDATE ds_employee 
                    LEFT OUTER JOIN ds_employee_address ON ds_employee.id_employee = ds_employee_address.fk_employee
                    LEFT OUTER JOIN ds_employee_detail ON ds_employee.id_employee = ds_employee_detail.fk_employee
                    SET 
                      ds_employee.emp_lastname = :emp_lastname,
                      ds_employee.emp_firstname = :emp_firstname,
                      ds_employee.emp_middlename = :emp_middlename,
                      ds_employee.emp_prefername = :emp_prefername,
                      ds_employee_address.address1 = :address1,
                      ds_employee_address.address2 = :address2,
                      ds_employee_address.city = :city,
                      ds_employee_address.state = :state,
                      ds_employee_address.postal_code = :postal_code,
                      ds_employee_address.country = :country,
                      ds_employee_detail.hphone = :hphone,
                      ds_employee_detail.wphone = :wphone,
                      ds_employee_detail.mphone = :mphone,
                      ds_employee_detail.emp_email = :emp_email,
                      ds_employee_detail.gender = :gender,
                      ds_employee_detail.DOB = :DOB,
                      ds_employee_detail.ssn = :ssn,
                      ds_employee_detail.ethnicity = :ethnicity,
                      ds_employee_detail.filing_staus = :filing_status,
                      ds_employee_detail.emp_sdate = :emp_sdate,
                      ds_employee_detail.fk_department = :fk_department,
                      ds_employee_detail.job_title = :job_title,
                      ds_employee_detail.fk_manager = :fk_manager,
                      ds_employee_detail.drug_test = :drug_test,
                      ds_employee_detail.bg_check = :bg_check
                    WHERE  ds_employee.id_employee = :id_employee"; 

            try {
              $st = $conn->prepare( $sql );
              $st->bindValue( ":emp_lastname", $this->data["emp_lastname"], PDO::PARAM_STR );
              $st->bindValue( ":emp_firstname", $this->data["emp_firstname"], PDO::PARAM_STR );
              $st->bindValue( ":emp_middlename", $this->data["emp_middlename"], PDO::PARAM_STR );
              $st->bindValue( ":emp_prefername", $this->data["emp_prefername"], PDO::PARAM_STR );
              $st->bindValue( ":address1", $this->data["address1"], PDO::PARAM_STR );
              $st->bindValue( ":address2", $this->data["address2"], PDO::PARAM_STR );
              $st->bindValue( ":city", $this->data["city"], PDO::PARAM_STR );
              $st->bindValue( ":state", $this->data["state"], PDO::PARAM_STR );
              $st->bindValue( ":postal_code", $this->data["postal_code"], PDO::PARAM_STR );
              $st->bindValue( ":country", $this->data["country"], PDO::PARAM_STR );
              $st->bindValue( ":hphone", $this->data["hphone"], PDO::PARAM_STR );
              $st->bindValue( ":wphone", $this->data["wphone"], PDO::PARAM_STR );
              $st->bindValue( ":mphone", $this->data["mphone"], PDO::PARAM_STR );
              $st->bindValue( ":emp_email", $this->data["emp_email"], PDO::PARAM_STR );
              $st->bindValue( ":gender", $this->data["gender"], PDO::PARAM_STR );
              $st->bindValue( ":DOB", $this->data["DOB"], PDO::PARAM_STR );
              $st->bindValue( ":ssn", $this->data["ssn"], PDO::PARAM_STR );
              $st->bindValue( ":ethnicity", $this->data["ethnicity"], PDO::PARAM_INT );
              $st->bindValue( ":filing_status", $this->data["filing_status"], PDO::PARAM_STR );
              $st->bindValue( ":emp_sdate", $this->data["emp_sdate"], PDO::PARAM_INT );
              $st->bindValue( ":fk_department", $this->data["fk_department"], PDO::PARAM_INT );
              $st->bindValue( ":job_title", $this->data["job_title"], PDO::PARAM_STR );
              $st->bindValue( ":fk_manager", $this->data["fk_manager"], PDO::PARAM_STR );
              $st->bindValue( ":drug_test", $this->data["drug_test"], PDO::PARAM_STR );
              $st->bindValue( ":bg_check", $this->data["bg_check"], PDO::PARAM_STR );

              $st->execute();
              parent::disconnect( $conn );
            } catch ( PDOException $e ) {
              parent::disconnect( $conn );
              die( "Query failed: " . $e->getMessage() );
            }
          }

不知道我做错了什么。我希望有人能帮助我

您似乎没有在任何地方设置
:id\u employee

非常感谢。这是其中的一部分。我还有一个拼写错误。ds_employee_detail.fileing_staus=:fileing_status,应该是fileing_status。但现在当它提交时,它会删除所有数据吗?有什么主意吗?我修好了。当我经过物体时,我错过了isset