Jump to content

Fulltext search help needed


fri3ndly

Recommended Posts

Hello all

 

I am trying to get a search facility working. I have added fulltext & index to the mysql columns/rows I need.

 

$keywords = $who.' '.$what.' '.$where;
$keywords = trim($keywords);

$res = $conn->query("SELECT * FROM business WHERE MATCH(name, town, county, postcode) AGAINST ($keywords) LIMIT 0,5");

 

The script only *works* at the moment if match() and against() contains just one word like 'apple', otherwise it gives me this error

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in website\includes\DbConnector.php on line 57

 

** When I say 'works' I mean it gives me no error - it does not display any results

Link to comment
https://forums.phpfreaks.com/topic/112919-fulltext-search-help-needed/
Share on other sites

Hi fenway

 

It gives the same result with or without them. What is interesting is in phpmyadmin when executing this query:

 

SELECT * 
FROM business 
WHERE MATCH(name) 
AGAINST ('flower') 

 

it gives me zero rows returned when there is 3-4 rows containing this keyword. For some reason it just wont let me MATCH more than one column

it gives me zero rows returned when there is 3-4 rows containing this keyword. For some reason it just wont let me MATCH more than one column

 

Wait a sec... did you actually create a multi-column fulltext index?

 

Also, when I try and echo out the query it just returns 'Resource id #7'

I meant the string, not the result.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.