gpt4 book ai didi

mysql - 无法从表单 zend 2 插入数据

转载 作者:行者123 更新时间:2023-11-28 23:51:29 25 4
gpt4 key购买 nike

我有以下代码将数据从 zend 表单插入到数据库表中,我在这里给出了模型的代码。

 public function Savemedic( $medicaldata,$id)
{
$medicadapter = $this->tableGateway->adapter;
$data = array(
'cardno' => $medicaldata->cardno,
'disabilityGroup' => $medicaldata->disabilityGroup,
'childhooddis' => $medicaldata->childhooddis,
'reason' => $medicaldata->reason,
'ilnessCrypt' => $medicaldata->ilnessCrypt,
'hearing' => $medicaldata->hearing,
'vision' => $medicaldata->vision,
'movement' => $medicaldata->movement,
'dcp' => $medicaldata->dcp,
'autism' => $medicaldata->autism,
'psychology' => $medicaldata->psychology,
'sensor' => $medicaldata->sensor,
'statodinamic' => $medicaldata->statodinamic,
'bloodflow' => $medicaldata->bloodflow,
'brithing' => $medicaldata->brithing,
'stomack' => $medicaldata->stomack,
'escression' => $medicaldata->escression,
'metabolism' => $medicaldata->metabolism,
'secression' => $medicaldata->secression,
'imunitet' => $medicaldata->imunitet,
'speach' => $medicaldata->speach,
'distortion' => $medicaldata->distortion,
' canser' => $medicaldata-> canser,
'other' => $medicaldata->other,
);
$resultstd=$this->tableGateway->insert($data);

$med_id=$this->tableGateway->lastInsertValue;
//$education_id=$this->tableGateway->lastInsertValue;
$dbAdapter = $this->tableGateway->adapter;

$medadapter=$this->tableGateway->getAdapter();
$medicaldataToStudent=new TableGateway('medicaldata_to_student', $medadapter);
$data_arr = array(
'student_id' =>$id,
'medical_id' => $med_id,
);
$medicaldataToStudent->insert($data_arr);
}

这会生成以下查询:

 object(PDOStatement)#553 (1) { ["queryString"]=> string(598) "INSERT INTO `medicaldata` (`cardno`, `disabilityGroup`, `childhooddis`, `reason`, `ilnessCrypt`, `hearing`, `vision`, `movement`, `dcp`, `autism`, `psychology`, `sensor`, `statodinamic`, `bloodflow`, `brithing`, `stomack`, `escression`, `metabolism`, `secression`, `imunitet`, `speach`, `distortion`, ` canser`, `other`) VALUES (:cardno, :disabilityGroup, :childhooddis, :reason, :ilnessCrypt, :hearing, :vision, :movement, :dcp, :autism, :psychology, :sensor, :statodinamic, :bloodflow, :brithing, :stomack, :escression, :metabolism, :secression, :imunitet, :speach, :distortion, : canser, :other)" }

但我收到此错误消息:

SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens

我错过了什么?

最佳答案

字段名称中有一个空格:

' canser' => $medicaldata-> canser,

关于mysql - 无法从表单 zend 2 插入数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32499295/

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