Hello everyone. This is my first post to this site. I've used it before as a reference and now I'm here with a question of my own.

I'm currently storing some data in a row like this:
"apples, oranges, pears, bananas, peaches"

Basically the row contains just a few terms separated by commas.

I need some help to formulate a SQL search statement on this row. Say the search term is "pears,peaches". Using the row above as a reference I want it to return results for any match of the search term in the row.

Search terms:
"pears,peaches" would return results
"bananas,oranges,apples" would return results
"apples" would return results

etc.

I've tried using the LIKE command. However it seems that some of my results are being left out because of the way I have the search terms formulated and the data setup.

Any ideas?

Thanks,
Tegan

I just marked my row as "FULL TEXT" in phpMyAdmin.

Now I'm able to use the niffy search terms.
"SELECT txt FROM {my_table} WHERE MATCH txt AGAINST ('$txt' IN BOOLEAN MODE)"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.