[eluser]plain jane[/eluser]
I am currently using lib_mysqludf_preg UDFs for regex pattern matching with Codeigniter and Activerecord. Using the PREG_REPLACE UDF, I was able to strip all non numeric and alphabetic characters with a custom query, Activerecord failed and returned an error result() on a non object
Works:
Code:
$query = $this->db->query(sprintf("SELECT * FROM table WHERE PREG_REPLACE('/[^a-zA-Z 0-9]+/' , '', UPPER(first_name)) = '%s' AND PREG_REPLACE('/[^a-zA-Z 0-9]+/' , '', UPPER(last_name)) = '%s'", $first_name, $last_name));
Doesn't work:
Code:
$this->db->where("PREG_REPLACE('/[^a-zA-Z 0-9]+/' , '', UPPER(first_name))", $first_name);
$this->db->where("PREG_REPLACE('/[^a-zA-Z 0-9]+/' , '', UPPER(last_name))", $last_name);
$query = $this->db->get('table');
Help.