2017-11-11 264 views
-2

我在查詢或任何地方沒有失誤的數量,但它給我的錯誤錯誤:綁定變量的數量不符令牌

綁定變量的數量不匹配的令牌的數量,無效參數數SQLSTATE [HY093]:

代碼

public function updatePost($id, $package_name, $package_description, $package_duration, $package_price, $package_type, $location, $file_name, $status) 
{ 
    $db = $this->getDB(); 
    $statement = $db->prepare("UPDATE packages 
    SET package_name =:package_name, package_description = :package_description, package_duration = :package_duration, package_price = :package_price, package_type = package_type, location = :location, image = :image, status = :status WHERE id = :id"); 

    $arrayValues = array(
    'id' => $id, 
    'package_name' => $package_name, 
    'package_description' => $package_description, 
    'package_duration' => $package_duration, 
    'package_price' => $package_price, 
    'package_type' => $package_type, 

    'location' => $location, 
    'image' => $file_name, 
    'status' => $status 
    ); 
    $statement->execute($arrayValues); 

    print_r($statement); 
} 

我在哪裏錯了...請幫助我。

+0

「UPDATE packages SET package_name =:package_name,package_description =:package_description,package_duration =:package_duration,package_price =:package_price,package_type =:package_type,location =:location,image =:image,status =:status WHERE id = :id「,檢查你的package_type部分,你錯過了: – oetoni

回答

2

您錯過了:for package_type in the query。

相關問題