jkatcherny Posted December 28, 2009 Share Posted December 28, 2009 Hey all, I've indexed the columns in my database that go with the query below, but I am not getting any results when I putting in terms that should be returning results. Is the syntax in the query incorrect? Thanks so much for any help. J - - <?php include 'config.php'; include 'opendb.php'; $keyword = $_POST['keyword']; $query = "SELECT * FROM Composer_Info WHERE MATCH(compFirst, compLast, compNumber, compEmail, pubCoAff, whereEmployed) AGAINST('$keyword')"; $result = mysql_query($query) or die(mysql_error()); $totalComposers = mysql_num_rows($result); $counter = 1; echo "<center> <table width='55%' cellpadding=0 cellspacing=6 border=0 class=style5> <tr><td>Total composers: ".$totalComposers."</td></tr></table> <table width='55%' cellpadding=3 cellspacing=2 border=1 class=style5> <tr> <td class=style4>Composer</td> <td class=style4>Composer Number</td> </tr>"; while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $_SESSION['compLast'] = $row['compLast']; $_SESSION['compFirst'] = $row['compFirst']; $_SESSION['composerid'] = $row['composerid']; if ($counter % 2) { echo "<tr bgcolor='#AFBD22'><td>"; } else { echo "<tr bgcolor='#B1BE52'><td>"; } echo "<a href='composer_info.php?title=".$_SESSION['composerid']."' class='style6' target='_new'>".$_SESSION['compFirst']." ".$_SESSION['compLast']."</a></td><td>"; echo $row['compNumber']; echo "</td></tr>"; $counter++; } echo "</table></center>"; include 'closedb.php'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/186515-fulltext-keyword-search-returning-no-results/ Share on other sites More sharing options...
fenway Posted December 28, 2009 Share Posted December 28, 2009 If that table doesn't have a lot of rows (i.e. 50% match), FULLTEXT doesn't work well. Quote Link to comment https://forums.phpfreaks.com/topic/186515-fulltext-keyword-search-returning-no-results/#findComment-985010 Share on other sites More sharing options...
jkatcherny Posted December 28, 2009 Author Share Posted December 28, 2009 ah ok, so i just need to add many rows? the term would produce a 50% match but there are literally only 2 rows in the table since it's a test. adding rows may remedy the problem? Quote Link to comment https://forums.phpfreaks.com/topic/186515-fulltext-keyword-search-returning-no-results/#findComment-985033 Share on other sites More sharing options...
pushpendra.php Posted December 29, 2009 Share Posted December 29, 2009 If that table doesn't have a lot of rows (i.e. 50% match), FULLTEXT doesn't work well. if you are searching for a word which is very common (occurs in 50% or more than 50% of rows,mysql will return nothing. specify which kind of search you want a boolean mode search or natural. Quote Link to comment https://forums.phpfreaks.com/topic/186515-fulltext-keyword-search-returning-no-results/#findComment-985389 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.