06-26-2005, 08:19 PM
|
#7 (permalink)
|
|
The Wanderer
Join Date: May 2005
Location: Maine|USA
Posts: 17
Thanks: 0
|
Ok, I've got the search working, but I do not care about the fulltext scoring being displayed. Here's the code:
PHP Code:
<?php if(!$c) { ?> <form action="index.php?c=1" method="post"> <input type="text" length="50" name="any" /> <input type="submit" value="Search" /> </form> <? } else if($c) { MySQL_connect("localhost", "", ""); MySQL_select_db("ogden2k_iedb"); if((!$all) || ($all == "")) { $all = ""; } else { $all = "+(".$all.")"; } if((!$any) || ($any == "")) { $any = ""; } $query = " SELECT *, MATCH(title, keyword) AGAINST ('$all $any' IN BOOLEAN MODE) AS score FROM movies WHERE MATCH(title, keyword) AGAINST ('$all $any' IN BOOLEAN MODE)"; $artm1 = MySQL_query($query); if(!$artm1) { echo MySQL_error()."<br />$query<br />"; } echo "<strong>Matches:</strong><br />"; if(MySQL_num_rows($artm1) > 0) { echo "<table>"; echo "<tr><td>Score </td><td>Title </td></tr>"; while($artm2 = MySQL_fetch_array($artm1)) { $val = round($artm2['score'], 3); $val = $val*100; echo "<tr><td>$val</td>"; echo "<td>{$artm2['title']}</td>"; } echo "</table>"; } else { echo "<em>No Results were found in this category.</em><br />"; } echo "<br />"; } ?>
|
|
|