php - codeigniter adding multiple condition of the model -


this code

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(); } 

this not working if remove language condition works in code want add 1 more condition newid => $newsid , want add 1 more here in code lanid = $lanid

regards in advance

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

you can set many wish

there's litereally no difference. since insist,

$this->db->get_where('table',     array('field1'=>'condition1',           'field2'=>'condition2',           'field3'=>'condition3') ); 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -