How to use multiple where condition in codeigniter?

I have to fetch the data from table using multiple where conditions in one table.I have tired so far but the results are not correct.

my code:

function Display(){     $category = $this->input->post('dms_category_id');     $subcategory =  $this->input->post('dms_subcategory_id');     $docname = $this->input->post('dms_doc_name');     $doctag = $this->input->post('dms_doc_tag');      $startdate = $this->input->post('dms_start_date');     $s_date = str_replace('/', '-', $startdate);     $newstart = date("Y-m-d", strtotime($s_date));          $enddate = $this->input->post('dms_end_date');     $e_date = str_replace('/', '-', $enddate);     $newend = date("Y-m-d", strtotime($e_date));       $data['documents']  = $this->db->query(         "SELECT *          FROM `dms_document` as `D`              LEFT OUTER JOIN `dms_category` as `C` ON `C`.`dms_category_id` = `D`.`dms_category_id`              LEFT OUTER JOIN `dms_sub_category` as `S` ON `S`.`dms_subcategory_id` = `D`.`dms_subcategory_id`          WHERE D.`dms_doc_tag` LIKE '%$doctag%' ESCAPE '!'          OR `dms_doc_tag` IN('$doctag')          AND `dms_expire_date` >= '$newstart'          AND `dms_expire_date` <= '$newend'          OR D.`dms_doc_name` IN('docname')          OR `D`.`dms_category_id` IN('category')          OR `D`.`dms_subcategory_id` IN('$subcategory')          ORDER BY D.`dms_id` ASC")     ->result_array(); $data['_view'] = 'dms_report/Report_List'; $this->load->view('layouts/main',$data); 

please help me solve this problem.

my picenter image description here

see this picture the last row also displaying ?

Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.