/ Published in: PHP
when someone trying to or two conditions using active record database library in codeigniter
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$this->db->from('posts'); $this->db->where('id', $id); $this->db->where('(`title` LIKE \'%'.$title.'%\' OR `body` LIKE \'%'.$body.'%\' OR `author` LIKE \'%'.$author.'%\')', NULL, FALSE); // Query: // SELECT * FROM (`posts`) WHERE (`title` LIKE '%ach%' OR `text` LIKE '%ach%' OR `author` LIKE '%ach%') AND `id` = '12'