I wish to implement a SQL statement using codeigniter active record.

UPDATE tags SET usage = usage+1 WHERE tag="java";

How do i implement this using Codeigniter active records?

Regards

$this->db->set('usage', 'usage+1', FALSE)
$this->db->where('tag', 'java');
$this->db->update('tags');

I've found its sometimes better to just write the SQL instead of getting Active Record construct it for me personally.

$sql = 'update tags set usage=usage+1 where tag=?';
$this->db->query($sql, array($tag));