Warning
Maybe using escape methode ($this->db->esc('NILAI')
) for key value pair is required for prevent SQL injection.
Update AS method is like update method but with unescaped key value pair. This method suitable for update column to column in a table.
This methode is available from SEME Framework version 4.0.2.
Update method has 2 required parameters that is table name and key value pair in array, another parameters are optional. Here is the completed parameters can be used by where methods
$this->db->update_as(string $table_name, array $data_update, [bool $is_debug=0]): bool
Fill with table name that will be updated.
Contains name and value pair in array. The key is for column name and the value is for new updated value.
Flag for activating debug mode.
Here is the examples usage for this method:
<?php
class Blog_Model extends SENE_Model{
var $tbl = 'blog';
var $tbl_as = 'b';
public function __construct(){
parent::__construct();
}
public function update(){
$du = array();
$du['counter'] = '`counter`+1';
$this->db->where("id",1);
$this->db->update_as($ths->tbl,$du);
}
}