How to Update Database Field Value +1 in CodeIgniter


In this tutorial, You will learn how to increment table field value using PHP Codeigniter. Recently I have implemented this in my blog when the article page viewed increment the view count by 1.

$this->db->set() This function enables you to set values for inserts or updates. set() will also accept an optional third parameter ($escape), that will prevent data from being escaped if set to FALSE.

$this->db->where() Specify where condition. Like in this case I have specified movie id.

$this->db->update() Generates an update string and runs the query based on the data you supply.


Leave A Reply

Your email address will not be published.