Welcome Guest, Not a member yet? Register   Sign In
Database Class: $this->db->like($field, $value, 'both'); with Wildcards (Underscore '_')
#3

[eluser]dakta[/eluser]
Code:
$this->db->like();

Should contain another parameter for whether or not the string should be escaped for "LIKE" wildcards. And so, my patch is attached.

This simply adds a parameter to every LIKE function in the Active Record class to allow you to specify whether or not to escape the LIKE string for wildcards.

Usage:
- Extract the PHP file,
- Back up your original DB_active_rec.php (in ./system/database/)
- Replace DB_active_rec.php contents with the contents of this file.

Code:
$this->db->like("column", "ex%mple", $escape=FALSE); //generates "... `column` LIKE '%ex%mple%'


Messages In This Thread
Database Class: $this->db->like($field, $value, 'both'); with Wildcards (Underscore '_') - by El Forum - 07-21-2011, 10:33 PM



Theme © iAndrew 2016 - Forum software by © MyBB