Re: Query produced by $this->User->save($this->data); gives error
On Fri, Apr 20, 2012 at 05:31, Mangesh Sathe
<reach.mangeshsathe@gmail.com> wrote:
> During registration i have email id, user name , password, confirm
> password in view , all of them are compulsory.
> but in database other fields like createdBy , newsletter etc are there. When
> i save form using $this->User->save($this->data);
> it generates query for only email id, user name , password ( confirm
> password match validation working fine) .
>
> How can i add values to createdBy , newsletter etc. fields? so that insert
> query will work for all the fields in table.
Before you call the save function set the other variables in the array.
$this->data['User']['createdBy'] = "the value you want to save";
$this->data['User']['newsletter'] = "of course they want the newsletter"
And then call save
$this->User->save($this->data);
This is assuming that you don't have form fields for those parts. If
you do, you will have to make sure that they are being passed properly
from the form. Check the output of $this->data to make sure they are
being set properly.
Mike.
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home