5
特定字段這裏是我的代碼如何保存在CakePHP
public function settings(){
$this->loadModel('Userinfo');
$helpers = array('TimeZoneHelper');
if($this->request->is('post')) {
$id = $this->Auth->User('idUser');
$data = $this->request->data['Userinfo']['timezone'];
$this->Userinfo->save($data,array(
'conditions' => array('Userinfo.User_id' => $id))));
}
我在用戶信息表有一個字段名時區 ..我想更新..我不知道我該怎麼明確地更新Cakephp中的單個字段,因爲我是Cakephp中的新成員..我正在執行此操作,但不知道爲什麼它不能正常工作......以及當我調試$ data ..數據會很好.. 在數據庫中,時區的數據類型是「時間」
你在這裏沒有顯示出很多努力 - 如果不是100個這樣的事情的重複問題有10個 - 它也包含在[文檔]中(http://book.cakephp.org/2.0 /en/models/saving-your-data.html)和[博客教程](http://book.cakephp.org/2.0/en/tutorials-and-examples/blog/blog.html)。看起來你只是在編寫代碼(傳遞條件來保存?你在哪裏見過?)。 – AD7six