Codeigniter escape_like_str() function

This function is useful when strings are used in the LIKE portion of your query. This enables the wildcards to be correctly escaped along with the string. Here’s
an example of its usage:

$like = 'w3m' ;
$sql = " SELECT id FROM table
  WHERE column LIKE ' %" . $this- >db->escape_like_str($like) . "%' ";
$this->db- >query($sql) ;

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.