gpt4 book ai didi

php - pdo 查询未运行

转载 作者:太空宇宙 更新时间:2023-11-03 10:49:28 25 4
gpt4 key购买 nike

<分区>

我似乎无法弄清楚为什么这个查询没有运行

if ( $productName && $productDescription && $productPrice ) {
// SQL
// UPDATE `prostud_tristurion`.`products` SET `product_title` = 'ajax test', `product_description` = 'Was certainty remaining engrossed applauded sir how discovery.', `product_price` = '524' WHERE `products`.`product_id` = 10;
try {

$query = "update products set product_title = :pName, product_description = :pDescription, product_price = :pPrice, where product_id = :pid";
//prepare query for excecution
$stmt = $con->prepare($query);

//bind the parameters
$stmt->bindParam(':pid', $id);
$stmt->bindParam(':pName', $productName);
$stmt->bindParam(':pDescription', $productDescription);
$stmt->bindParam(':pPrice', $productPrice);
// echo "$productPrice / $productDescription / $productName / $id\n $stmt";
var_dump($_POST);
// Execute the query
if ($stmt->execute() ) {
echo "Record was updated.";
} else {
die('Unable to update record.');
}

}catch(PDOException $exception){ //to handle error
echo "Error: " . $exception->getMessage();
}
}

我得到的只是无法更新记录。

var_dump($_POST); 

看起来不错

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