I think what you are looking for is this:
http://api.cakephp.org/2.3/class-DboSource.html#_expression
$this-Invite-id = $data['Invite']['id'];
$this-Invite-set(array(
'send_count' =
$this-Invite-getDataSource()-expression('send_count + 1'),
'sent' =
Thanks for your reply.
--
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
On Thu, Sep 8, 2011 at 6:14 AM, Ryan Schmidt google-2...@ryandesign.com wrote:
You really do want to be doing it the way the OP said: by running an atomic
UPDATE statement that does the increment directly in the database, not in PHP
code. I'm sure it's easy to do that in CakePHP but I don't
@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
If you construct your Data Array properly with the fields you want to
save you can directly call $this-User-save()
So you already have $user['User']['id'];
Add to it
$user['User']['count_login'] = $count_login +1;
$user['User']['last_login'] = date('Y-m-d H:i:s');
Then just save it
Read
On Sep 7, 2011, at 02:38, Dr. Tarique Sani wrote:
On Wed, Sep 7, 2011 at 12:24 PM, Richard Neil Roque wrote:
Hi i'm a new developer using CakePHP.
I would like to know
How can i update a field using a function.
Example is
UPDATE Users SET AGE=AGE+2+3+4 WHERE id=1???
If you construct