mysql - how to get Even/Odd id numbers from a database table in codeigniter -
i new in codeigniter , stacked in query solve report emergency project. please me codeigniter's experts.
- i have large database table , wants show odd/even data rows table filtered table field named "sale_id". tried in phpmyadmin in raw coding , it's worked me. can not apply in codeigniter.
select * ospos_pak_sub_cat id %2 =0;
worked me in raw php coding. how can use in codeigniter. used condition on query , want add new query. existing condition given below, working fine.
$this->db->where('sale_date between "'. $inputs['start_date']. '" , "'. $inputs['end_date'].'"');
it working , tried code below solution not working , getting error.
$this->db->where('sale_id %2'=> 0);
getting error line. says--
parse error: syntax error, unexpected '=>' (t_double_arrow)
please me solutions. in advance.
in model, write query that:
$this->db->select('*'); $this->db->from('ospos_pak_sub_cat'); $this->db->where('sale_id %2=', 0); $query_result = $this->db->get(); $result = $query_result->result();
you missed '=' in code. hope, work.
Comments
Post a Comment