Delete Method

The delete method is a part of the query builder which is useful for deleting data in a table by execute DELETE SQL command.

Basic Usage

Here is the basic usage delete method from $db property on SENE_Model class.

$this->db->delete(string $table_name [, int $is_debug=0]): boolean

Parameters

This method has 1 required parameter and 1 optional parameter.

$table_name

The name of table that will be deleted.

$is_debug

The $is_debug parameter is a marker (flag) to enable debug mode. The value of this parameter can be filled with int 1 to enable debug mode and display the query to be processed. Fill it with another value to not enable debug mode. In debug mode, there will be no query execution process to the database system.

Example Usage

Here is the examples using delete method on blog_model.php file

class Blog_Model extends SENE_Model{
  var $tbl = 'd_order';
  var $tbl_as = 'dor';
  public function __construct(){
    parent::__construct();
    $this->db->from($this->tbl,$this->tbl_as);
  }
  public function delete($id){
    $this->db->where("id",$id);
    return $this->db->delete($this->tbl);
  }
}