@@ 811-819 (lines=9) @@ | ||
808 | * @param int $value |
|
809 | * @return mixed |
|
810 | */ |
|
811 | public function increment($id, $field, $value=1) |
|
812 | { |
|
813 | $value = (int)abs($value); |
|
814 | ||
815 | $this->db->where($this->primary_key, $id); |
|
816 | $this->db->set($field, "{$field}+{$value}", false); |
|
817 | ||
818 | return $this->db->update($this->table_name); |
|
819 | } |
|
820 | ||
821 | //-------------------------------------------------------------------- |
|
822 | ||
@@ 832-840 (lines=9) @@ | ||
829 | * @param int $value |
|
830 | * @return mixed |
|
831 | */ |
|
832 | public function decrement($id, $field, $value=1) |
|
833 | { |
|
834 | $value = (int)abs($value); |
|
835 | ||
836 | $this->db->where($this->primary_key, $id); |
|
837 | $this->db->set($field, "{$field}-{$value}", false); |
|
838 | ||
839 | return $this->db->update($this->table_name); |
|
840 | } |
|
841 | ||
842 | //-------------------------------------------------------------------- |
|
843 |