Thursday, September 8, 2011

Re: How can i update a field using a function

@Richard: I model-ise my user_visits so I know latest and previous
visits etc. and then have a CounterCache on that join.

But, this certainly works $this->ShopProduct-
>updateAll(array('ShopProduct.view_count'=>'view_count + 1'),
array('ShopProduct.id'=>$product['ShopProduct']['id']));

HTH, Paul
@phpMagpie

P.S. @Tarique, I agree Ryan did jump down your throat a bit, but it is
always a good idea to provide the most effective solution to a
question and the OP did ask how to run a function within the database
call to update a field.

--
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

No comments: