codeigniter-base-model icon indicating copy to clipboard operation
codeigniter-base-model copied to clipboard

"like" statement for search !

Open abouhanna opened this issue 10 years ago • 4 comments
trafficstars

Hello, how we can use the like statement ???

exmp :

$this->db->like('title', 'match');

// Produces: WHERE title LIKE '%match%'

get all posts that title contains the "match" string.

Tnx.

abouhanna avatar Sep 03 '15 14:09 abouhanna

+1 for this feature

bereldhuin avatar May 24 '16 17:05 bereldhuin

http://www.codeigniter.com/user_guide/database/query_builder.html implementation (in MY_Model)

public function like($field, $match = '', $side = 'both', $escape = NULL) {
$this->_database->like($field, $match, $side, $escape);
return $this;
}

michail1982 avatar May 26 '16 09:05 michail1982

thnx michail1982 :)

abouhanna avatar May 26 '16 09:05 abouhanna

+1 for this feature. nice work @michail1982 this should be added into the next version. If the creator of this doesn't plan on updating anymore, then maybe we should create a new one fork.

timothymarois avatar Aug 04 '16 18:08 timothymarois