updateall in cakephp code example

Example: update all cakephp

$update = $this->updateAll(
  	array(value need to update),
	array(conditions)
);

Ex:
$update = $this->updateAll(
  array(
    'MemberLoginMethod.token' => NULL,
  ),
  array(
    'MemberLoginMethod.member_id' => $member_id
  )
);


// note: remmeber add " with string and date
  $this->MembersPush->updateAll(array(
    'MembersPush.pushed' => "\"" . $date . "\"",    // update with "" s
  ), array(
    'MembersPush.device_token' => $device,  // conditions
    'MembersPush.push_history_id' => $push_history_id,
    'MembersPush.type' => $type,
  ));

Tags:

Php Example