Abdus Sattar Bhuiyan
Abdus Sattar Bhuiyan

Reputation: 3074

How to change specific fields in cakephp?

I have a table as follows: enter image description here

I want to update the following data:

Array
(
    [Reseller] => Array
        (
            [id] => 1
            [name] => Abdus Sattar Bhuiyan
            [mobile] => 01673050495
            [email] => [email protected]
        )

)

keeping unchanged others. So How can I do this. I try with saveField. It works for only one field updating at a time.

N.B: I am using cakephp 2.9

Upvotes: 0

Views: 58

Answers (1)

Pradeep Singh
Pradeep Singh

Reputation: 1280

Try this

$data['id'] = 1;
$data['name']  = 'Abdus Sattar Bhuiyan';
$data['mobile'] = '01673050495';
$data['email'] = '[email protected]';

$this->Reseller->save($data,false);

Never forget to put the field id for which you are updating the record.

Upvotes: 1

Related Questions