CodeIgniter Forums
Prevent white space in query being converted to percent 20 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Prevent white space in query being converted to percent 20 (/showthread.php?tid=57144)



Prevent white space in query being converted to percent 20 - El Forum - 02-19-2013

[eluser]Andy78[/eluser]
I have the following function in my model that I want to use to search for phrases and so on. However if I pass in more than one word the spaces are always converted to the percent20 symbol which breaks my query. How do I avoid this?

Also is this type of query secure? or do I need t escape $term first?

Code:
function get_search_entries($limit, $start, $term)
   {
        
        $this->db->select('statuses.id, title, status, posted_by, created, rating, name');
        $this->db->from('statuses');
        $this->db->join('categories', 'categories.id = statuses.category_id');
        
        $this->db->where('MATCH (title, status) AGAINST ("'.$term.'")', NULL, FALSE);
        $this->db->limit($limit, $start);
        $query = $this->db->get();
        
        if ($query->num_rows() > 0) {
            
            return $query->result();  
        }
        
        return false;      
   }



Prevent white space in query being converted to percent 20 - El Forum - 02-20-2013

[eluser]Andy78[/eluser]
Cant believe nobody had an answer for this!. It appears that xxs filter automaticaly converts white space. any way it was solved by using :

rawurldecode($term);