hasek522 Posted August 14, 2008 Share Posted August 14, 2008 I am creating a search for my website using FULLTEXT in sql but am having trouble with a query. Here is the code that creates the search: $search = '%' . $search . '%'; $sql = "SELECT * FROM stylists WHERE MATCH(firstname, lastname,address, city, salon, specialty) AGAINST ('" . $search . "');"; when ever i run this if im searching for "Jason" and type "Jason" it finds it no problem. But say I type "Jasonb" it dosnt find "Jason". Should the two wild cards i attach to the search variable fix that problem? Or am i missing something else. Quote Link to comment Share on other sites More sharing options...
DarkWater Posted August 14, 2008 Share Posted August 14, 2008 You aren't supposed to use wildcards with FULLTEXT. Quote Link to comment Share on other sites More sharing options...
hasek522 Posted August 14, 2008 Author Share Posted August 14, 2008 so is there any way to achieve a similiar result using FULLTEXT? Quote Link to comment Share on other sites More sharing options...
Barand Posted August 14, 2008 Share Posted August 14, 2008 Have you set up a fulltext index? Quote Link to comment Share on other sites More sharing options...
hasek522 Posted August 14, 2008 Author Share Posted August 14, 2008 ya i did and the query works but its not achieving the results i was looking for. I was hoping that a search for "Sand" would turn up "Sandy" Quote Link to comment Share on other sites More sharing options...
Jabop Posted August 14, 2008 Share Posted August 14, 2008 Make sure that none of these apply to your scenario: http://dev.mysql.com/doc/refman/5.0/en/fulltext-restrictions.html 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.