$this->Product->id = 40; $this->Product->saveField('vote', $this->Product->field('vote') + 1);
Nick On Mar 12, 9:36 am, "Krissy Masters" <naked.cake.ba...@gmail.com> wrote: > $this->Product->updateAll(array('Product.vote'=>'Product.vote+1'), > array('Product.id'=>40)); > > So we are updating Product ID = 40 where the vote is vote + 1 increment > basically what the above is saying. > > Original article: > > http://nuts-and-bolts-of-cakephp.com/2008/05/22/incrementing-a-field-... > php/ > > From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf > Of tubiz > Sent: Saturday, March 12, 2011 12:36 PM > To: cake-php@googlegroups.com > Subject: Auto Increment A Field > > Please I would like to know how to increment a field in my database table > once an action is viewed. I have a view field in my lyrics table and i want > the field to be incremented by one once a visitor click to read a lyrics. I > would like to know how this can be implemented. > -- > Our newest site for the community: CakePHP Video > Tutorialshttp://tv.cakephp.org > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group > athttp://groups.google.com/group/cake-php -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php