Do you need a PHP programmer?
Use my services as a freelance PHP programmer by hiring me to do PHP programming on your website project.

I have built many custom PHP applications like project managers, classified ad websites and content management systems. I also work with open source applications such as WordPress, online shopping cart websites like Magento and develop content management systems like Joomla.

Monday, January 28, 2013

View Counter (Update field +1) - Cakephp

Hi Hallo,
This week (29 jan 2013), I still work in my current project with cakephp framework.
Today I find small problem but I will always share with you guys. I work on I called view counter, where if there any client view detail of any property in my site, it will update field count in database +1.
Maybe it look easy if we do with php and sql. But how we can do it with cakephp framework?

I'm googling, and found this code below:

$this->Article->updateAll(
             array('Property.count' => 'Property.count + 1'),
             array('Property.id' => 5)
);


Hope it can help,
But if you still have any question, write your comment below.

Kind regard,
Bayu Prawira

No comments:

Post a Comment