Return to Snippet

Revision: 57922
at June 15, 2012 00:00 by pruntrut


Initial Code
$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'

Initial URL
http://pvibeesh.wordpress.com/2009/02/13/codeigniter-grouping-or-conditions-using-active-record-database-library/

Initial Description
when someone trying to or two conditions using active record database library in codeigniter

Initial Title
Codeigniter grouping OR conditions using active record database library

Initial Tags
php, codeigniter

Initial Language
PHP