gpt4 book ai didi

mysql - fatal error : Uncaught exception 'PDOException' with message 'SQLSTATE[HY093]'

转载 作者:行者123 更新时间:2023-12-03 09:03:28 28 4
gpt4 key购买 nike

出于某种原因,我不断收到'SQLSTATE [HY093] 错误。解决方案必须很简单,但我只是没有看到它。该错误表明它位于 ControllerStore.php 的第 83 行(包含在下面)和 store_update.php 的第 55 行(也包含在下面)

ControllerStore.php

public function updateStore($itm) 
{
$stmt = $this->pdo->prepare('UPDATE tbl_storefinder_stores

SET store_name = :store_name,
store_desc = :store_desc,
lat = :lat,
lon = :lon,
phone_no = :phone_no,
email = :email,
category_id = :category_id,
created_at = :created_at,
updated_at = :updated_at,
is_deleted = :is_deleted,

idade = :idade,
peso = :peso,
oral = :oral,
anal = :anal,
dom = :dom,
eles = :eles,
elas = :elas,
casais = :casais,
acessorios = :acessorios,
eventos = :eventos,
viagens = :viagens,
idiomas = :idiomas,
horarios = :horarios,
hora = :hora,
locais = :locais,
kiss = :kiss


WHERE store_id = :store_id');

$result = $stmt->execute(
array('store_name' => $itm->store_name,

'store_desc' => $itm->store_desc,
'lat' => $itm->lat,
'lon' => $itm->lon,
'phone_no' => $itm->phone_no,
'email' => $itm->email,
'category_id' => $itm->category_id,
'created_at' => $itm->created_at,
'updated_at' => $itm->updated_at,
'is_deleted' => $itm->is_deleted,
'idade' => $itm->idade,
'peso' => $itm->peso,
'oral' => $itm->oral,
'anal' => $itm->anal,
'dom' => $itm->dom,
'eles' => $itm->eles,
'elas' => $itm->elas,
'casais' => $itm->casais,
'acessorios' => $itm->acessorios,
'eventos' => $itm->eventos,
'viagens' => $itm->viagens,
'idiomas' => $itm->idiomas,
'horarios' => $itm->horarios,
'hora' => $itm->hora,
'locais' => $itm->locais,
'kiss' => $itm->kiss

));

return $result ? true : false;

}

store_update.php
if($store_id != null) {

$store = $controller->getStoreByStoreId($store_id);

if( isset($_POST['submit']) ) {

$itm = new Store();
$itm->store_name = htmlspecialchars(trim(strip_tags($_POST['store_name'])));
$store_desc = preg_replace('~[\r\n]+~', '', $_POST['store_desc']);
$itm->store_desc = htmlspecialchars(trim(strip_tags($store_desc)));
$itm->lat = trim(strip_tags($_POST['lat']));
$itm->lon = htmlspecialchars(trim(strip_tags($_POST['lon'])), ENT_QUOTES);
$itm->created_at = time();
$itm->phone_no = htmlspecialchars(trim(strip_tags($_POST['phone_no'])), ENT_QUOTES);
$itm->email = trim(strip_tags($_POST['email']));
$itm->category_id = trim(strip_tags($_POST['category_id']));
$itm->updated_at = time();
$itm->is_deleted = trim(strip_tags($_POST['is_deleted']));
$itm->idade = trim(strip_tags($_POST['idade']));
$itm->peso = trim(strip_tags($_POST['peso']));
$itm->oral = trim(strip_tags($_POST['oral']));
$itm->anal = trim(strip_tags($_POST['anal']));
$itm->dom = trim(strip_tags($_POST['dom']));
$itm->eles = trim(strip_tags($_POST['eles']));
$itm->elas = trim(strip_tags($_POST['elas']));
$itm->casais = trim(strip_tags($_POST['casais']));
$itm->acessorios = trim(strip_tags($_POST['acessorios']));
$itm->eventos = trim(strip_tags($_POST['eventos']));
$itm->viagens = trim(strip_tags($_POST['viagens']));
$itm->idiomas = trim(strip_tags($_POST['idiomas']));
$itm->horarios = trim(strip_tags($_POST['horarios']));
$itm->hora = trim(strip_tags($_POST['hora']));
$itm->locais = trim(strip_tags($_POST['locais']));
$itm->kiss = trim(strip_tags($_POST['kiss']));


$controller->updateStore($itm);
echo "<script type='text/javascript'>location.href='stores.php'; </script>";
}
}
else {
echo "<script type='text/javascript'>location.href='403.php';</script>";
}

最佳答案

变量的数量与绑定(bind)变量的数量不匹配。

您在 store_update.php 中缺少 is_deleted

关于mysql - fatal error : Uncaught exception 'PDOException' with message 'SQLSTATE[HY093]' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32938316/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com