codeigniter에서 테이블 이름을 매개 변수로 전달하여 테이블을 동적으로 조인하려고합니다. 아래 모델 함수codeigniter에서 테이블을 동적으로 조인하는 방법은 무엇입니까?
function index(){
$table=array('branch'=>'branch_id','specialization'=>'spec_branch_id');
$this->model->join($table);
}
전화 내 컨트롤러의 함수이며,이 난 표 = 분기 같은 동적 테이블 이름을 원하는 위에서 함수로서 내 모델 함수
function join($table){
foreach($table as $table_name=>$table_id){
/*i want here table*/
$table1=$table_name;
}
$this->db->select('*');
$this->db->from(''.$table1.' t1');
$this->db->join(''.$table2.' t2','t1.'.$t1id.'=t2.'.$t2id);
return $this->db->get();
echo $this->db->last_query();die;
}
이고; table2 = 내 모델의 특수 기능이므로, 해결하도록 도와주세요. 다른 사람도 공유 할 수 있다면 도와주세요.
는 센을 @pawan 감사합니다 –