replaced the mysql_real_escape_string function with $this->db->escape for compatibility