On Wed, Jun 24, 2009 at 3:35 AM, Rangi<[email protected]> wrote: > > Hello, > > I've searched the manual and this group for an answer to this but > can't find anything, so wondering if anyone can help. > > I'd like to do a query like this: > > UPDATE product SET num_ratings = num_ratings + 1; > > In CakePHP I can't figure out how to do it in less than 2 queries > (load record to look up num_ratings, increment num_ratings in php, > save record). > > Should I just use a custom query for this?
See here: http://teknoid.wordpress.com/2008/05/22/incrementing-a-field-in-cakephp/ Also, check out IncrementBehavior http://bakery.cakephp.org/articles/view/increment-behavior --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
