Reputation: 3240
data is coming this form
Array
(
[User] => Array
(
[first_name] => sxsaxs
[last_name] => sdsdsd
[contact_no] => 9569908024
[address_1] => sdasd
[address_2] => dsdsdsd
[country_id] => 1
[state_id] => 1
[city_id] => 1
)
)
users_controller.php
public function my_account_edit(){
if(!empty($this->data))
{
$this->User->id = $this->Auth->user('id');
// echo $id= $this->User->id = $this->Auth->user('id'); it's working echo id
if($this->User->save($this->data['User']))
{
$this->Session->setFlash("Account has been saved");
$this->redirect(array('action' => 'my_account'));
}
}
but update query not working where id = $this->Auth->user('id');
i am not getting where is problem in my code
Upvotes: 0
Views: 1418
Reputation: 26431
Try like this,
$this->data['User']['id'] = $this->Auth->user('id');
instead of
$this->User->id = $this->Auth->user('id');
Also check this
$this->User->save($this->data['User'])
make it $this->User->save($this->data)
Upvotes: 1