我正在尝试向此函数添加类别参数:
public function get_prog_channel($chaine_id = NULL, $nb = NULL, $debut = NULL) {
$q = $this->db->select('*');
$q->from($this->table_prog);
if($nb !==NULL || $debut !== NULL){
$q->LIMIT($nb, $debut);}
if ($chaine_id !== NULL) {
$q->where('channel_id', $chaine_id);
$q->join($this->table_emission, 'programs.id=emissions.id');
return $q ->get()
->result();
} else {
return $q->get()
->result();
}
}
这是我的桌子:
- 程序(id,title,emission_id ...)
- 排放(id,....,channel_id) 类别(id,...)
- rel_emission_categories(category_id,emission_id)
我该怎么做?