検索クエリの結果を出力していますが、何らかの理由で複数の結果が出力されません。疲れているからかもしれませんが、誰かが私が犯している間違いに気づきますか?
私がやりたいことは、検索バーから入力された単語でデータベースを検索し、入力のすべての一致または近い一致を見つけることです。
何か不足していますか?
$search = $_POST['search'];
// We preform a bit of filtering
$filtered = mysql_real_escape_string($search);
//Select what add to look for.
$ad_type = $_POST[''];
//Now we search for our search term, in the field the user specified
$sql = "SELECT * FROM busadverts WHERE MATCH(advert_name, advert_description, advert_tags) AGAINST('". $filtered ." IN BOOLEAN MODE')";
$result = mysql_Query($sql) or die(mysql_error());
//And we display the results
while($row = mysql_fetch_array( $result ))
{
$adname = $row['advert_name'];
$adimage = $row['advert_image'];
$addesc = $row['advert_description'];
$adurl = $row['advert_url'];
$searchresult .= "<div style='width: 800px; height: 200px;'>
<div class='titleBar' style='text-align: center; background: #000; color: #fff;'>"
. $adname . "
</div>
<div class='advertimage' style='width: 150px; height: 150px; float: left; background: #111;text-align: center;'>
<img src='" . $adimage . "' />
</div>
<div class='advertdescription' style='width: 635px; height: 150px; float: left; background: #222;color: #fff; padding-left: 15px;'>Description: <br />"
. $addesc ."
<br /><br /> Website link: <a href='" .$adurl."'>"
. $adurl . "</a>
</div>
</div>";
}
//This counts the number or results - and if there wasn't any it gives them a little message explaining that
$anymatches=mysql_num_rows($result);
if ($anymatches == 0)
{
echo "Sorry, but we can not find an entry to match your query<br><br>";
}
mysql_free_result($result);
//And we remind them what they searched for
echo "<b>Results: </b> " .$search. "" ;
echo $searchresult;
前もって感謝します。