Forum Moderators: open
I'm trying to construct a query that will query multiple fields from a database table and will return just those results where the query string is found, in order of relevance.
I'm working in both PHP5 and MySQL5
This is what I have so far:
$query = "SELECT `list_id`, `business_name`, `name_first`, `name_middle`, `name_last`, `category`, `address_city`, `address_country`, `status`, MATCH ( `business_name` ,
`name_first` ,
`name_middle` ,
`name_last` ,
`address_1` ,
`address_2` ,
`address_3` ,
`address_city` ,
`address_state` ,
`address_zip` ,
`address_country` ,
`email` ,
`about_me` ,
`p_keywords` ) AGAINST ($string) AS relevancy FROM `directory` WHERE MATCH (`business_name` ,
`name_first` ,
`name_middle` ,
`name_last` ,
`address_1` ,
`address_2` ,
`address_3` ,
`address_city` ,
`address_state` ,
`address_zip` ,
`address_country` ,
`email` ,
`about_me` ,
`p_keywords`) AGAINST ($string ) AND status = 'active' ORDER BY relevancy "; The above example returns no results, even though I know that the 4 letter term searched for, exists many times in the database fields searched.
Any help would be greatly appreciated.
Thanks guys
pete