[eluser]machouinard[/eluser]
I'm trying to increment a 'count' field in a MySQL table.
Table is InnoDB.
Count field is int(11).
When I run this, it sets the count to whatever $count is instead of incrementing it.
What am I missing here?
Do I need to get the value of count first, add that to $count, then update?
Seems like this should work.
Code:
public function increase_count($album_id=2, $count=1){
$data = array(
'count' => 'count' + $count,
);
$this->db->where('id', $album_id);
if($this->db->update('album', $data)){
echo 'Count should be updated';
}
die();
}
Thanks,
Mark
EDIT: Changed title from increase to increment.