0

这是我的代码

public function get_news($NewsId= FALSE)
{
    if ($NewsId === FALSE)
    {
    $query = $this->db->get('news');
    return $query->result_array();
    $config['per_page']; $this->uri->segment(3);
    }
    $query = $this->db->get_where('news',
                             array('NewsId' => $NewsId,
                                    'Language' => '2');
    return $query->row_array();
}

如果我删除语言条件,这不起作用所以它 在代码中工作我想再添加一个条件,比如当前是 NewId => $NewsId,我想在此代码中再添加一个 LanId = $LanId

提前问候

4

1 回答 1

2
$this-db->where(field1,condition1);
$this-db->where(field2,condition2);
$this-db->where(field3,condition3);
$this->db->get(table);

you can set as many as you wish

there's litereally no difference. but since you insist,

$this->db->get_where('table',
    array('field1'=>'condition1',
          'field2'=>'condition2',
          'field3'=>'condition3')
);
于 2013-04-05T08:35:49.907 回答