If this query for select all records where id =11
$this->db->select('title')->from('mytable')->where('id', $id)->limit(10, 20);
$query = $this->db->get();
then what is the query to select all records where id != 11 in CodeIgniter
style.
Just add it to the column part of the where, so
$this->db->select('title')->from('mytable')->where('id !=', $id)->limit(10, 20);
$query = $this->db->get();
Btw, always check the codeigniter manual, it mentions it right with the where()
documentation and it's one of the best documentations you are ever going to find.
This might work:
$this->db->select('title')->from('mytable')->where('id !=', $id)->limit(10, 20);
$query = $this->db->get();
This is also a professional and clean way :)
$where(array('id !' => $id, 'qty >' => '10'));
$this->db->select('title');
$this->db->from('mytable');
$this->db->where($where);
$this->db->limit(10, 20);
$query = $this->db->get();