Reputation: 6136
I have simple search engine with paginated results in my codeigniter application. When I send results into function, it queries database and makes pagination:
function keyword_search($keyword, $from){...}
I have simple, basic codeigniter pagination based on standard pagination library. It all goes well until I'm trying to use national polish characters in search, i'm using
urldecode($keyword)
inside keyword_search() and it queries database well, but the problem is, when I'm trying to paginate. The perfect solution would be to convert these national characters into some universal ones, push this value in url and when my APP will se this converted string in URL, it will search for my native not-converted string (it's good to not have national chars for SEO purposes too).
For making a solution, let's say, that function, which converts polish characters into english ones is
$this->polish_characters($keyword);
Where should I keep my original search string, which I want to search for by the time I will be pushing the converted one in URL for pagination purposes?
Upvotes: 0
Views: 107
Reputation: 4331
For conversion, you can use PHP's iconv.
And since you're using utf8_general_ci, you will still be able to search for both versions of the keyword. Just use like and MySQL will be able to pull words like 'máša' even though you supply 'masa' as a search parameter:
SELECT * FROM myTable WHERE keyword like 'masa'
Upvotes: 1