public function services()
{
$username=$this->session->userdata('username');
if($username!='')
{
$crud = new grocery_CRUD();
$crud->set_table('tbl_services');
$crud->set_subject('Services');
$crud->columns('s_id','s_companyname','s_type','s_country','s_state','s_district','s_email','s_mobile','s_photo','s_active');
$crud->set_relation('s_type','tbl_service_cat','service_desc');
$crud->set_relation('s_country','tbl_country','country');
$crud->set_relation('s_state','tbl_state','state');
$crud->set_relation('s_district','tbl_district','district');
$crud->set_field_upload('s_photo','uploads');
$crud->callback_after_update(array($this,'rename_serviceimg_db'));
$crud->callback_after_insert(array($this,'rename_serviceimg_db'));
//$crud->set_relation('q_id','tbl_discussionanswer','q_id');
$output = $crud->render();
$this->_admin_output($output);
}
else
{
$this->index();
}
这是我的控制器功能。在这种类型中,country,dist,state作为数据库中的相应id插入。但我想要名字本身。