在这里,我已经使用CakePHP的JS助手发送数据后,插入一个数据,我需要为进一步work.Here这最后的ID我都试过娄代码在AddcontrollerCakePHP的getLastInsertId不工作
if ($this->Patient->save($this->request->data)) {
$lastid=$this->Patient->getLastInsertId();
$patient=$this->Patient->find('all',array(
'conditions'=>array('Patient.id'=>$lastid),
'recursive' => -1
));
$this->set('patient', $patient);
}
在add.ctp我试过了波纹管代码,但我没有在这里得到最后一个ID。
<?php foreach ($patient as $patient): ?>
<?php echo h($patient['Patient']['id']); ?>
<?php endforeach; ?>