the total result is not the same with the result rows when use group_by, so I added the group_by function and return $q->num_rows() instead of $this->ci->db->count_all_results($this->table)
As the conditional is being placed with a LIKE comparison function, the codeigniter documentation recommends using escape_like_str() (http://codeigniter.com/user_guide//database/queries.html). I was getting ' placed within the statement '%'xxx'%'...
…oesn't work with other databases, and/or mysqli.
…u establish multiple databases connections in your config/database file.
…method turns out to be unstable. Users are advised to only use it when working with foreign characters for json output.
…ct charset instead
…allowed ones can be used.