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
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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.