2015-09-30 80 views
-1

請幫幫我!我有錯誤麻煩SQLSTATE [HY093]:參數號無效[請教]

PDOStatement對象::執行():SQLSTATE [HY093]:無效的參數編號:綁定變量的數量不匹配

令牌的數量我使用查詢:

public function SaveStep1($data) 

    $id = intval($data['id']); 

    $query = $this->db->prepare("UPDATE `user_general_info` SET `soname` = :soname, `last_soname` = :last_soname, `name` = :name, 
     `middle_name` = :middle_name, `birthday` = :birthday, `birthplace` = :birthplace, `city_code` = :city_code, 
     `city` = :city, `street` = :street, `house` = : house, `corp` = :corp, `litera` = :litera, `flat` = :flat WHERE `id` = :id"); 
    $query->bindParam(":soname", $data[0], PDO::PARAM_STR); 
    $query->bindParam(":last_soname", $data[1], PDO::PARAM_STR); 
    $query->bindParam(":name", $data[2], PDO::PARAM_STR); 
    $query->bindParam(":middle_name", $data[4], PDO::PARAM_STR); 
    $query->bindParam(":birthday", $data[5], PDO::PARAM_STR); 
    $query->bindParam(":birthplace", $data[6], PDO::PARAM_STR); 
    $query->bindParam(":city_code", $data[7], PDO::PARAM_STR); 
    $query->bindParam(":city", $data[8], PDO::PARAM_STR); 
    $query->bindParam(":street", $data[9], PDO::PARAM_STR); 
    $query->bindParam(":house", $data[10], PDO::PARAM_STR); 
    $query->bindParam(":corp", $data[11], PDO::PARAM_STR); 
    $query->bindParam(":litera", $data[12], PDO::PARAM_STR); 
    $query->bindParam(":flat", $data[13], PDO::PARAM_STR); 
    $query->bindParam(":id", $data['id'], PDO::PARAM_INT); 
    //print_r($data[0]); 

    return $query->execute(); 

回答

2

您在SQL語句中的錯字:

`house` = : house 

應該是

`house` = :house 
相關問題