[eluser]Alex007[/eluser]
It seems that with ActiveRecord it is impossible to increment the value of a field without fetching it first.
Here's what I'd like to do:
Code:
$this->db->where('ThreadId', $ThreadId);
$this->db->set('ViewCount = ViewCount + 1');
$this->db->update('Forum_Threads');
But that doesn't work, the resulting query looks something like this:
Code:
UPDATE Forum_Threads SET 'ViewCount = ViewCount + 1' = '' WHERE ThreadId = 1
Is there anyway, with ActiveRecord, to increment a field, without fetching it's value first ? I don't need to know the value at all, so SELECTing it first would be a waste of resources.
Do I have to resort to simple_query() ?