Reputation: 69
I have the following code to insert data from zend form into database table I am giving here model's code.
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);
}
And this generates the following query:
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)" }
but I am getting this error message:
SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens
What did I miss?
Upvotes: 1
Views: 72
Reputation: 15057
Ther is a space in the Field name:
' canser' => $medicaldata-> canser,
Upvotes: 1