View Full Version : Searching a database via keyword(s)

04-21-2011, 08:52 PM
Hi :)

On the site I'm building I want users to be able to search user posts, which I have stored in a mysql table. So if a user searches for the keyword tree (for example), I want it to return every user post that contains the word tree.

I just can't wrap my head around how to do this, I imagine there is some sort of function that can help me acheive this, I just don't know of it. I do not want code, I just want someone to point me in the right direction. Thank you :)

Old Pedant
04-21-2011, 09:20 PM
SELECT list, of, fields FROM table WHERE someField LIKE '%tree%' OR someOtherField LIKE '%tree%'

Fair warning: It will be slow slow slow on a large table.