public function __construct() { parent::__construct(); } public function getData($id = '') { if ($id == ''): return $this->db->get('news');//SELECT * FROM news else: return $this->db->where('id', $id)->get('news'); endif; }
public function insert($post) { $this->db->insert('news', $post); }
public function update($post) { $this->db->where('id', $post['id'])->update('news', $post); }
public function delete($id) { $this->db->where('id', $id)->delete('news'); }