Hi all,
i'm very new to cake but i like it a lot!! great work!
at the moment im in trouble with a field update. I cannot understand how to do it.
Let me explain:
the user comes to my site and register himself. he receive an email
with an activation code, then he clicks on the link in the email, and i read the code
he passed in the url string. now i want to update the field "subscribed"
from 0 to 1 for that user only.
the code
Users model ... yada yada
Users Controller ... yada yada
$subscribed=$this->User->find("oid = '$userOid'");
if (!empty($subscribed) && $subscribed['User']['subscribed'] == 0)
{
// this line of code is creating a lot of trouble!
$this->data['User']['subscribed'] = 1;
if (!$this->User->save($this->data['User'])) {
$this->redirect('/errorpage');
};
$this->render('activationCompletePage');
};
i receive the user record by the method find, but when i put $this->data['User']['subscribed'] = 1 and save the record, it saves a new record with all the fields empty but with the field subscribed = 1.
What i'm doing wrong? how can i update that field?
thanks in advance
fabrizio
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake PHP" 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
-~----------~----~----~----~------~----~------~--~---
- updating an existent field Fabrizio Mancini
- Re: updating an existent field dima
- Re: updating an existent field Fabrizio Mancini
