Welcome Guest, Not a member yet? Register   Sign In
problem with search
#1

[eluser]huuray[/eluser]
hi all,
looked the forum,google.com,but no luck with search with space "code igniter"

Code:
function search()
{        
echo $this->uri->segment(3);
}

when i try to browse http://localhost/user/search/code igniter , it will return code_igniter

any idea?
sorry for my poor english
#2

[eluser]Simian Studios[/eluser]
Try http://localhost/user/search/code+igniter or http://localhost/user/search/code%20igniter and it should work. At a guess the URI class is automatically converting the invalid space to an undserscore as a default behaviour.
#3

[eluser]huuray[/eluser]
is it ok if i use this ? -> str_ireplace("_"," ",$search_query);
#4

[eluser]Simian Studios[/eluser]
That should work - I would make sure to convert spaces in search queries to underscores first though, just so you know what you're dealing with. Unless people are likely to include underscores in their search queries, in which case you'll need a different character of course..
#5

[eluser]huuray[/eluser]
ok,thanks simian studios.




Theme © iAndrew 2016 - Forum software by © MyBB