在PHP中使用PDO
$sql="......";
$statement->($sql);
执行报下面的错误Invalid parameter ariables does not match number of tokens

解决方案 »

  1.   


    $sql = "INSERT INTO company  (csf_code,hq_ctry_cd,hq_post_code,reg_ctry_cd,reg_post_code,create_date_loc,registed_capital,capital_curr_cd,fin_year,cpny_listed,cpny_covered,cpny_status,crt_stmp,crt_user,pub_stmp,pub_user,upd_stmp,upd_user) VALUES (:csf_code,:hq_ctry_cd,:hq_post_code,:reg_ctry_cd,:reg_post_code,:create_date_loc,:registed_capital,:capital_curr_cd,:fin_year,:cpny_listed,:cpny_covered,:cpny_status,:crt_stmp,:crt_user,:pub_stmp,:pub_user,:upd_stmp,:upd_user)";
    $statement = $this->PDO->prepare($sql);
    $statement->bindParam(":csf_code",$company['comCSFCode'],PDO::PARAM_STR);
    $statement->bindParam(":hq_ctry_cd",$company['comHQCountryCode'],PDO::PARAM_STR);
    $statement->bindParam(":hq_post_code",$company['comHQPostCode'],PDO::PARAM_STR);
    $statement->bindParam(":reg_ctry_cd",$company['comRegCountryCode'],PDO::PARAM_STR);
    $statement->bindParam(":reg_post_code",$company['comRegPostCode'],PDO::PARAM_STR);
    $statement->bindParam(":create_date_loc",$company['comCreateDateLocale'],PDO::PARAM_STR);
    $statement->bindParam(":registed_capital",$company['comRegCapital'],PDO::PARAM_STR);
    $statement->bindParam(":capital_curr_cd",$company['comRegCapitalCurrCode'],PDO::PARAM_STR);
    $statement->bindParam(":fin_year",$company['comFinYear'],PDO::PARAM_STR);
    $statement->bindParam(":cpny_listed",$company['comListed'],PDO::PARAM_INT);
    $statement->bindParam(":cpny_covered",$company['comCovered'],PDO::PARAM_INT);
    $statement->bindParam(":cpny_status",$company['comUpdating'],PDO::PARAM_INT);
    $statement->bindParam(":crt_stmp",$company['comCreateTime'],PDO::PARAM_STR);
    $statement->bindParam(":crt_user",$company['comCreateUser'],PDO::PARAM_INT);
    $statement->bindParam(":pub_stmp",$company['comPubTime'],PDO::PARAM_STR);
    $statement->bindParam(":pub_user",$company['comPubUser'],PDO::PARAM_INT);
    $statement->bindParam(":upd_stmp",$company['comUpdateTime'],PDO::PARAM_STR);
    $statement->bindParam(":upd_user",$company['comUpdUser'],PDO::PARAM_INT);

    $statement->execute();