php - Set field value for single database row -
i'm trying update row on profiles
table reset users profile picture default of user.png
. have following action in controller:
public function deleteprofilepicture() { $this->layout = 'ajax'; // first find profile id user id $profileid = $this->profile->find('first', array( 'condition' => array('user.id' => $this->auth->user('id')), 'fields' => array('profile.id'), 'recursive' => -1 )); $this->profile->id = $profileid['profile']['id']; $this->profile->savefield('picture', 'user.png', false); }
however, when request url (/profile/deleteprofilepicture
) no errors database row isn't updated. have made sure current profile id used using debug($profileid)
.
what going wrong here?
edit: return value of savefield()
:
array( 'profile' => array( 'id' => '36', 'modified' => '2013-04-05 14:16:57' ) )
try
$this->profile->id = $profileid['profile']['id']; $this->profile->set(array( 'picture' => 'user.png' )); $this->post->save();
Comments
Post a Comment