gpt4 book ai didi

PHP/mysql 我的代码有什么问题,它插入到了错误的列

转载 作者:行者123 更新时间:2023-11-29 21:12:59 25 4
gpt4 key购买 nike

class.user.php
public function orderInsert($servicetype,$templateselection,$orderdetails)
{
try
{
$stmt = $this->conn->prepare("INSERT INTO tbl_order(TypeofService,TemplateSelect,orderdetails)
VALUES(:Service_Type, :Template_Select, :order_details)");

$stmt->bindparam(":Service_Type",$servicetype);
$stmt->bindparam(":Template_Select",$templateselection);
$stmt->bindparam(":order_details",$orderdetails);
$stmt->execute();
return $stmt;
}
catch(PDOException $ex)
{
echo $ex->getMessage();
}
}


userTrans.php

if($activity == "OrderInsert")
{
$TypeofService = $_POST[TypeofService];
$TemplateSelect = $_POST[TemplateSelect];
$orderdetails = $_POST[orderdetails];





if($user_home->OrderInsert($_SESSION[userSession],$TypeofService,$TemplateSelect,$order_details))
{
echo response(1,'Inserting '.$TypeofService.' Order, success!',0);
}else{
echo response(0,'Inserting '.$TypeofService.' Order, failed!',0);
}

}

结果:

最佳答案

您将 4 个参数传递给 orderInsert,因此您的数据存在偏差...

从对 orderInsert 的调用中删除 SESSION['userSession'] 或将相应的字段添加到数据库表中,并在函数中接受它。

关于PHP/mysql 我的代码有什么问题,它插入到了错误的列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36213256/

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