![]() |
Codeigniter, Activerecord and MySQL UDFs - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Codeigniter, Activerecord and MySQL UDFs (/showthread.php?tid=59124) |
Codeigniter, Activerecord and MySQL UDFs - El Forum - 08-27-2013 [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); Help. |