File: /var/www/html/pmw24/app/application/models/Mcommon.php
<?php
class Mcommon extends CI_Model {
function __construct(){
parent::__construct();
}
public function insert($table,$data){
$this->db->insert($table,$data);
return $this->db->insert_id();
}
public function batch_insert($table,$data){
$this->db->insert_batch($table,$data);
return 1;
}
public function getDetails($table,$condition){
$this->db->where($condition);
$query=$this->db->get($table);
return $query->result_array();
}
public function getRow($table,$condition){
$this->db->where($condition);
$query=$this->db->get($table);
return $query->row_array();
}
public function checkUser($table,$condition){
$this->db->where($condition);
$query=$this->db->get('admins');
return $query->row_array();
}
public function update($table,$condition,$data){
$this->db->where($condition);
$this->db->update($table,$data);
//echo $this->db->last_query();die;
return 1;
}
public function delete($table,$condition){
$this->db->where($condition);
$this->db->delete($table);
return 1;
}
public function getRowLast($table,$condition,$order_by,$order){
$this->db->from($table);
$this->db->where($condition);
$this->db->order_by($order_by, $order);
$this->db->limit(1, 0);
$query = $this->db->get();
return $query->row_array();
}
}