Returning number of times string found?

wxdqz

New Member
Hi!

I've found that FULLTEXT isn't supported on the version of MySQL on a friends server (and I'm too lazy to upgrade), so I'm writing my own search thingy.

I want to search the 'Description' for each record, and return how many times the term was found. Is this possible?

I'm splitting the search term on spaces and/or commas, and than want to make a list of how many times each term was found in each description.

SELECT * FROM sites WHERE Description LIKE '%$term%'

doesn't return the number of matches.

The only way I can think is to pull the entire lot into variables and use php functions, but that seems a little stupid (as we could have thousands of records!).

Thanks,

Danny
 
Back
Top