I have a table with a column that includes names like:
- Home Improvement Guide
- Home Improvement Advice
- Home Improvement Costs
- Home Gardening Tips
I would like the result to be:
- Home Improvement
- Home Gardening Tips
Based on a search for the word 'Home'.
This can be accomplished in MySQL or PHP or a combination of the two. I have been pulling my hair out trying to figure this out, any help in the right directly would be greatly appreciated. Thanks.
Edit / Problem kinda solved:
I think this problem can be solved much easier by changing the logic a little. For anyone else with this problem, here is my solution.
- Get the sql results
- Find the first occurrence of the searched word, one string at a time, and get the next word in the string to the right of it.
- The results would include the searched word concatenated with the distinct adjoining word.
Not as good of a solution, but it works for my project. Thanks for the help everyone.