0

In codeigniter, I need a custom active record class that can group where clauses. Upon stumbling i found this and a tutorial on how to extend the mysql driver. Upon doing so, I receive an error of Fatal error: Call to undefined method MY_DB_mysql_driver::select(). I have followed the steps stated on the tutorial but still no luck.

Here's my sql statement:

$this->db->select('post_id, post_title');
$this->db->from('articles');
$this->db->where($sqlParams);
$this->db->open_bracket();
$this->db->or_like($sqlLikeParams);
$this->db->close_bracket();
Community
  • 1
  • 1
basagabi
  • 4,900
  • 6
  • 38
  • 84

1 Answers1

0

Your custom active record class must extends CI_Model

class Active_record extends CI_Model {

  function __construct()
  {
    parent::__construct();
  }


  function your_function() { 

   /* Your code here*/
    $this->db->select('post_id, post_title');
    $this->db->from('articles');
    $this->db->where($sqlParams);
    $this->db->open_bracket();
    $this->db->or_like($sqlLikeParams);
    $this->db->close_bracket();
  }
}
Rafiqul Islam
  • 1,636
  • 1
  • 12
  • 25