Simple way off accessing mysql tables in codeigniter
Easy base model to setup so you can slim down that controller.
add the public $table_name;
/**
* Get all research types, returns all
*
* @return object
*/
private function get_TableAccess()
{
$query = $this->db->get($this->table_name);
if ($query->num_rows() > 0) return $query->result() ;
return NULL;
}
function get_GetTable($table = NULL){
$this->table_name = $table;
return $this->get_tableaccess();
}
do the call:
$data['countries'] = $this->get_GetTable('Countries');
No comments yet.
