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);
}
}
结果:
答案 0 :(得分:0)
您将4个参数传递给orderInsert
,因此您的数据存在偏差......
从您对SESSION['userSession']
的调用中移除orderInsert
或向数据库表中添加相应的字段,并在您的函数中接受它。