在codeigniter中使用or_where子句写出类似条件

时间:2015-10-06 05:52:58

标签: php codeigniter

这是我的控制器。我想要解决以下查询,

      $this->datatables ->select('e.emp_id')
            ->select('CONCAT(e.first_name," ",e.middle_name," ",e.last_name) as name',FALSE)
            ->select('e.contact_no,e.dob,e.designation,e.email_id,e.short_address,e.landmark,a.po_region_name,a.state')
                              ->add_column('Edit ',' <a href="'.site_url().'/employee/edit_employee/$1" class="fa fa-pencil icons"></a>| <a href="'.site_url().'/employee/delete_employee/$1" class="fa fa-trash-o icons"></a>', 'e.emp_id')
                             ->from('employee e')
                         ->join('address_pin_details a','a.uid=e.address_detail_id')

                            ->where('e.emp_id',$emp_id)
                            ->or_where("CONCAT(e.first_name, ' ', e.middle_name,' ',e.last_name) LIKE '%$fname%'", NULL, FALSE)
                            ->or_where('e.email_id',$email_id)
                            ->or_where('a.po_region_name',$city)
                            ->or_where('e.contact_no',$contact_no)
                            ->where('e.is_active',1);




In this query only one search name condition work properly can you help me to work all search conditions correctly. we want like condition for searching concatenation of first name, last name, middle name. 

提前致谢!

0 个答案:

没有答案