错误:绑定变量数与令牌数不匹配

时间:2017-11-11 09:06:06

标签: php pdo

我在查询或其他任何地方都没有错误,但它给了我错误

  

绑定变量数与令牌数不匹配,参数号无效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);
}

我在哪里错了...请帮助我。

1 个答案:

答案 0 :(得分:3)

您错过了:查询中的package_type。