I want a Codeigniter select query from a table with three conditions in .
1. wrk_fld_exc = 140
2. wrk_cs_sts = Open
3. wrk_dlvrd_sts = Delivered OR wrk_cl_st
$this->db->select("*");
$this->db->from("table_name");
if($condition1 != ''){
$this->db->where('wrk_fld_exc', 140);
}
if($condition2 != ''){
$this->db->where('wrk_cs_sts ', open);
}
//You can limit the results
$this->db->limit(5);
$q = $this->db->get();
return $q->result();
This is the basic structure of the query you can implement in this way in codeigniter. You can add conditions if you require.