Building a page that outputs each result from a search based on location/distance/w.e however I want the first result to be a "recommended" page if it falls within the search parameters. Each entry in the database has a row "recommended" and either yes or no.
If its =="yes" then it changes the background to yellow however if could be the 3rd, 6th and 17th result in the list. I want it so it shows 1 recommended at the top of the search results and then the rest and normal.
Search results so far:
while($row = mysql_fetch_array( $result )) {
if ($row['recommended'] == "Yes") {
echo '<div id="results_box_site" style="background-color: #ffffdf;">';
}
else {
echo '<div id="results_box_site">';
}
echo '<a href="site.php?id=' . $row['site_ID'] . '"><img class="results_site_image" src="' . $row['site_logo'] . '" /></a>';
echo '<h1><a href="site.php?id=' . $row['site_ID'] . '">' . $row['site_name'];
if ($row['recommended'] == "Yes") {
echo ' - Recommended site';
}
echo '</a></h1>';
echo '<h2>Next game date: ' . $row['next_game'] . '</h2>
<img src="images/rating/5star.png" /> (rating 5/5 - 2 reviews)
<p id="results_box_content">';
echo $row['short_desc'];
echo '<br/><br/><a href="site.php?id=' . $row['site_ID'] . '"> >> More information <<</a>
</p>
<h3 id="results_box_content">Facilities</h3>
<div id="details">
<ul>';
echo '<li>' . $row['lunch'] . '</li>';
echo '<li>' . $row['shop'] . '</li>';
echo '<li>' . $row['toilets'] . '</li>';
echo '<li>Minimum age: ' . $row['min_age'] . '</li>';
echo '<li>Game Type: ' . $row['game_type'] . '</li>';
echo '<li>Site Type: ' . $row['site_type'] . '</li>';
echo '<li>' . $row['price'] . '</li>';
echo '<li>' . $row['packages'] . '</li>';
echo '</ul>
</div>
</div>';
}
Messy code I know but any help would be appreaciated