I have this at my model, I want to update the price everynow and then, I want that everytime I open the controller it will add up 100 to the Penalty, how do I do that? what is wrong with my query? Probably because of the update right? I dont know plz help! If I put 200 at 'Penalty' + 200 it will go for 200 and then if I put 100 it puts 100 again
public function addPenalty(){
$data = array(
'Penalty' => 'Penalty' + 100
);
$this->db->where('Active',1);
$query = $this->db->update('tbl_client_penalties',$data);
return $query;
}
Try this code
$this->db->set('Penalty', 'Penalty + '.100, FALSE);
$this->db->where('Active',1);
$this->db->update('tbl_client_penalties');
for more information check the document.
Try this code
$dbdata["Penalty"] = "Penalty + 100";
$this->db->update("tbl_client_penalties", $dbdata, array('Active' => 1));