include_once("MyDB_class.php");
require('../Bean/appointment_class.php');
class AppointmentModle extends MyDB{
public function addAppointment($appointment){
$this->mysqli->query("set names gb2312");
$query="insert into db_appointment (A_title,A_time,A_content,A_author) values (?,?,?,?)"; $stmt=$this->mysqli->prepare($query);
$stmt->bind_param('sdss',$A_title,date("Y-m-d"),$A_content,$A_author); 报错 $A_title=$appointment->getA_title();
// $A_time=$appointment->getA_time();
$A_content=$appointment->getA_content();
$A_author=$appointment->getA_author();
//echo $A_title,$A_time,$A_author,$A_content;能正确输出内容
// exit;
$stmt->execute();
if($stmt->affected_rows!=1){
$this->printError("数据插入失败:".$stmt->error);
return false;
}
else{
return $this->mysqli->insert_id; }
} }
require('../Bean/appointment_class.php');
class AppointmentModle extends MyDB{
public function addAppointment($appointment){
$this->mysqli->query("set names gb2312");
$query="insert into db_appointment (A_title,A_time,A_content,A_author) values (?,?,?,?)"; $stmt=$this->mysqli->prepare($query);
$stmt->bind_param('sdss',$A_title,date("Y-m-d"),$A_content,$A_author); 报错 $A_title=$appointment->getA_title();
// $A_time=$appointment->getA_time();
$A_content=$appointment->getA_content();
$A_author=$appointment->getA_author();
//echo $A_title,$A_time,$A_author,$A_content;能正确输出内容
// exit;
$stmt->execute();
if($stmt->affected_rows!=1){
$this->printError("数据插入失败:".$stmt->error);
return false;
}
else{
return $this->mysqli->insert_id; }
} }
//echo $A_title,$A_time,$A_author,$A_content;能正确输出内容
但你在 $stmt->bind_param('sdss',$A_title,date("Y-m-d"),$A_content,$A_author);
这些变量并不存在呀
$this->mysqli->query("set names gb2312");
$query="insert into db_appointment (A_title,A_time,A_content,A_author) values (?,?,?,?)"; $stmt=$this->mysqli->prepare($query);
这几句有错误。
这个函数返回的值里没有
bind_param这个方法
$sql = "INSERT INTO mis_order(cid,sid,ordTime,ordPrice) VALUES(?,?,?,?);";
$stmt = $this->mysqli->prepare($sql);
$stmt->bind_param("iiss",$cid,$sid,$time,$ordPrice);
$stmt->execute();
$stmt->store_result();
$rows = $stmt->affected_rows;
if($rows > 0){
header("location:sysAction.php?index=0");
}else{
echo "订单信息添加失败!<br/>";
}
$stmt->close();
$this->mysqli->close();
}