Note that there are some explanatory texts on larger screens.

plurals
  1. POFullText Search Only Displays 1 result
    text
    copied!<p>I'm outputting results for a search query, but for some reason, it's not outputting more than one result. It may be, because i'm tired but anyone spot the mistake i'm making?</p> <p>All i want it to do, is search my database with the inputted word from the search bar and find all matches or close matches of the input.</p> <p>Am i missing something?</p> <pre><code>$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 .= "&lt;div style='width: 800px; height: 200px;'&gt; &lt;div class='titleBar' style='text-align: center; background: #000; color: #fff;'&gt;" . $adname . " &lt;/div&gt; &lt;div class='advertimage' style='width: 150px; height: 150px; float: left; background: #111;text-align: center;'&gt; &lt;img src='" . $adimage . "' /&gt; &lt;/div&gt; &lt;div class='advertdescription' style='width: 635px; height: 150px; float: left; background: #222;color: #fff; padding-left: 15px;'&gt;Description: &lt;br /&gt;" . $addesc ." &lt;br /&gt;&lt;br /&gt; Website link: &lt;a href='" .$adurl."'&gt;" . $adurl . "&lt;/a&gt; &lt;/div&gt; &lt;/div&gt;"; } //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&lt;br&gt;&lt;br&gt;"; } mysql_free_result($result); //And we remind them what they searched for echo "&lt;b&gt;Results: &lt;/b&gt; " .$search. "" ; echo $searchresult; </code></pre> <p>Thanks in Advance.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload