I still have yet to find a straight forward way to do this, so ill
simply do something like this:
function update($user_id, $fields) {
if (is_array($fields)) {
App::import('Sanitize');
Sanitize::clean($fields);
$cleanFields = array();
foreach ($fields as $field => $value) {
$cleanFields[] = "User.". $field ." = '". $value ."'";
}
$sql = "UPDATE users AS User SET ". implode(', ', $cleanFields)
."
WHERE User.id = ". Sanitize::escape($user_id) ." LIMIT 1";
return $this->query($sql);
}
return NULL;
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---