Part of the EllisLab Network
   
2 of 2
2
Incrementing a counter in the database
Posted: 29 May 2009 09:35 AM   [ Ignore ]   [ # 16 ]  
Summer Student
Total Posts:  5
Joined  05-29-2009

cause I’m learning Active Record smile I know there I can create SQL as string, but just was curious if that can be done via Active Record

Profile
 
 
Posted: 30 May 2009 01:29 PM   [ Ignore ]   [ # 17 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  3176
Joined  06-11-2007

Strange. The following works so I assumed that would:

$this->db->update('table''offence_count = offence_count + 1', array('id'10)); 
 Signature 

————————
Blog | Twitter | GitHub | BitBucket
————————-
PyroCMS - open source modular CMS built with CodeIgniter
PancakeApp - Simple, hosted invoicing/w project management

Profile
 
 
   
2 of 2
2