Help Active Records Query |
Here My SQL Query
Code: SELECT `id`, `name`, `dob` FROM (`tbl_personal`) WHERE `group_id` = '666' AND (`fname` = 'Devid' OR `fname` = 'Jhone'') I want to know how to write this query using CI Active records ? Thanks.
try something like this
$this->db->select('id'); $this->db->select('name'); $this->db->select('dob'); $this->db->where('group_id',666); $this->db->where('fname','devid'); $this->db->or_where('fname','jhone'); $this->db->from('tbl_personal');
try something like this in your model class:
Code: public function get_personal() { also just to point out, you may want to read the documentation.
"I reject your reality and substitute my own" - Adam Savage, M5 Inc.
The answer really depends on which version of CI you're using. CI3 has some advanced features to build stuff like that... AND (something OR something_else)
|
Welcome Guest, Not a member yet? Register Sign In |