![]() |
[SOLVED] HowTo: Array/multiple words in POST that goes to a searchfunction - 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: [SOLVED] HowTo: Array/multiple words in POST that goes to a searchfunction (/showthread.php?tid=10130) |
[SOLVED] HowTo: Array/multiple words in POST that goes to a searchfunction - El Forum - 07-19-2008 [eluser]Devon Lambert[/eluser] Hello CI community, I am hoping that someone can point me in the right direction here. I have my paginated search class working properly when searching for 1 word. However, when I attempt to search for more than 1 word, it all goes to hell and it throws back an invalid/empty search. -------------- I was actually able to solve this by doing the following in my Search Model: MODEL: Code: function getSearchResults ($keyword, $limit, $offset) Turns out you were right on the money CJunky! Hope it might help someone else out. :-) [SOLVED] HowTo: Array/multiple words in POST that goes to a searchfunction - El Forum - 07-20-2008 [eluser]thinkigniter[/eluser] Interesting... I've never had to do a multi word search script so where both learning here. So it works for one work but not many. Lets say where looking for duke nukem Well $keyword isn't {explode}d so it's only looking for a single word duke nukem with the space? or one work "dukenukem". What if we explode the $keyword and look in the format of LIKE 'duke' AND LIKE 'nukem' therefor looking for both words in a result. Then look for individual results or_like('duke'), or_like('nukem') What do you think? [SOLVED] HowTo: Array/multiple words in POST that goes to a searchfunction - El Forum - 07-20-2008 [eluser]Devon Lambert[/eluser] Thanks for the response CJ. That is one scenario, but not the perfect solution either. Take for instance, the search used right here in CI. I can enter multiple terms and it works just fine, spitting back all of the results that contain/match my posted input. I'll have to dig into this one further tomorrow morning, but I think you may on the right path. :-) |