here is my code
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))));
}
i have a field name timezone in my userinfo table .. which i want to update .. i dont know how can i specifically update the single field in Cakephp as i am new in Cakephp ..i am doing this but dont know why it isn't working ...well when i debug the $data .. the data is coming fine .. in database the datatype of timezone is "time"
Set you models id:
$this->Userinfo->id = $id;
Then, use the savefield function to save a specific field:
$this->Userinfo->saveField('timezone', 'UTC');
Good luck further on cakePhp!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With