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. Link to comment https://forums.phpfreaks.com/topic/119586-sql-query-question/ 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. Link to comment https://forums.phpfreaks.com/topic/119586-sql-query-question/#findComment-616121 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? Link to comment https://forums.phpfreaks.com/topic/119586-sql-query-question/#findComment-616750 Share on other sites More sharing options...
Barand Posted August 14, 2008 Share Posted August 14, 2008 Have you set up a fulltext index? Link to comment https://forums.phpfreaks.com/topic/119586-sql-query-question/#findComment-616816 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" Link to comment https://forums.phpfreaks.com/topic/119586-sql-query-question/#findComment-616867 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 Link to comment https://forums.phpfreaks.com/topic/119586-sql-query-question/#findComment-616874 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.