Update Method

Update method is part of database class builder for updating a table.


Update method has 2 required parameters that is column name and value, another parameters are optional. Here is the completed parameters can be used by where methods

$this->db->update(string $table_name, array $data_update, [bool $is_debug=0]): bool


Data update is key value pair in an array. The key refer to column name of the table.

Example usage

Here is the examples using insert method. See the first of this page for full example.

Basic Usage

For example we assumed want to edit title in blog table. First, in the model:

class Blog_Model extends SENE_Model{
  var $tbl = 'blog';
  var $tbl_as = 'b';
  public function __construct(){
  public function update($id,$du){

at the controller, we assumed has file named blog.php

class Blog extends Sene_Controller{
  public function __construct(){
    $this->load('blog_model','bm'); #class scope model
  public function index(){
    $id = 1;
    $du = array();
    $du['title'] = "This is new title of this blog!";
    $res = $this->bm->update($id,$du); //call the method on the model
      echo 'Success';
      echo 'failed';