fri3ndly Posted July 2, 2008 Share Posted July 2, 2008 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 Quote Link to comment Share on other sites More sharing options...
fenway Posted July 2, 2008 Share Posted July 2, 2008 What does the query look like after? My guess is you're missing single quotes around $keywords. Quote Link to comment Share on other sites More sharing options...
fri3ndly Posted July 2, 2008 Author Share Posted July 2, 2008 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 Quote Link to comment Share on other sites More sharing options...
fri3ndly Posted July 2, 2008 Author Share Posted July 2, 2008 Also, when I try and echo out the query it just returns 'Resource id #7' Quote Link to comment Share on other sites More sharing options...
fri3ndly Posted July 2, 2008 Author Share Posted July 2, 2008 I now have the fulltext set up correctly, I had made loads of single fulltexts by mistake which was confusing the system. Its just not returning any results :-\ Quote Link to comment Share on other sites More sharing options...
fenway Posted July 2, 2008 Share Posted July 2, 2008 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.