Re: Insert instead of update - tried everything
Thanks for replying,
Unfortunately, when I don't explicitly set the Model's ID, it INSERTS
and new records instead of performing an UPDATE.
I seem to have got it working. It had something to do with the id of
the object being 0. I changed it in the DB to 1, and it seems to work
as expected.
I am not sure why this would be the case...
On Apr 15, 4:20 pm, euromark <dereurom...@googlemail.com> wrote:
> $this->Auction->id ???
>
> it's $this->id inside the model
> u are already using it correctly in $this->saveField!
>
> On 15 Apr., 15:29, mattcrox <mattc...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > I've looked through numerous posts, and tried about 5 different ways
> > of updating a single column in a record of mine.
>
> > Here's my method (within the Auction model class):
>
> > function setFinished($id)
> > {
> > echo 'Trying to setFinished with id of ' . $id;
> > $this->Auction->id = $id;
> > $this->saveField('finished', '1');
> > }
>
> > It adds a new field, with null parameters for every other column to my
> > DB. I've tried variations of reading the data first with, $this->Auction-read(null, $id), and then setting the value, and saving, to
>
> > no avail.
>
> > Any help?
>
> > Thank you - Matthew
--
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