Generate Datatable From Secondary Datebase
Generate Datatable From Secondary Datebase
Helllo everyone,
i want to generate datatable from secondary database
i am using codeigniter and i have connected two databases in model
this is my constrictor of model to work with two database
public function __construct() {
parent::__construct();
$this->user_database = $this->load->database('mysql://root:@localhost/tallyplusweb_3',TRUE);
}
to fetch data from second database below function is working
function groups_list() {
$this->user_database->select('groups.*');
$this->user_database->from('groups');
$query = $this->user_database->get();
return $query->result_array();
}
but for generating datatable from second database below approach is not working
function groups_datatable() {
$this->load->library('Datatables');
$this->datatables->select('groups.groupname as groupname,groups.parent as parent,groups.status as status');
$this->datatables->from('groups');
$query = $this->datatables->generate();
return $query;
}
Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
This question has an accepted answers - jump to answer
Answers
You'd need to ask the author of the CI package that you are using. I'm afraid I've never even used CI so can't really help in that regard.
Allan
thanks to all
issue is solved, we have to use set_database method of datatables libraray to set secondary database....
its done...thanks