Jump to content

Search results page displaying problems


aquapetcentre

Recommended Posts

Hi, I have a results page that shows the results of a search. The problem is that the results appears as follows

 

eg.

1st result - is displayed in black

2nd result - is displayed in white

3rd result - is displayed in black

4th result - is displayed in white

 

I cannot understand why that is.

 

Here is the script

<?php
include 'init.php';

// normal search
$result_tb = "";
if (!empty($_POST['SEARCH']) && !empty($_POST['search_value'])) {

   $e = $_POST['search_value'];

  $query = "SELECT live_item_id, listing_title, town, cost, postage_cost FROM live_sales
WHERE CONCAT_WS(' ', live_item_id, listing_title, fishtype, speciesCommon, speciesScientific, town, county) LIKE '%$e%'";

   $query_result = $con->query($query);
 $result_tb = '<h2>Search Results:</h2>';
   while ($rows = $query_result->fetch_assoc()) {
        $v = $rows['live_item_id'];
        $u = $rows['listing_title'];
        $x = $rows['town'];
        $a = $rows['cost'];
        $c = $rows['postage_cost'];
        $b = urlencode($a);
        $d = urlencode($c);
        $y = urlencode($x);
        $v = urlencode($v); // since this is a text name, make it url encoded
        $result_tb .= "<hr><p1><a class='searchLive' href='searchResultslive.php?live_item_id=$v'>Listing Title: $u - Town - $y <strong>Price:</strong> £$b - <strong>Postage Cost:</strong> £$d</a></p1><br>";
    }  


   $result_tb .='';

   $con->close();
}
?>
<?php
include 'includes/overall/header.php';
?>
<div class="centerDiv">
<h1>Search Species for Sale</h1>
<p>Search for the aquatic species of your choice.</p>
<p> You can search for your item via species type, name, scientific name, town or county.</p>
      <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
         <table>
            <tr>
               <td>
                  <input type="text" name="search_value" size="40" maxlength="40" value="Search for species"/>
               </td>
               <td>
                  <input type="submit" name="SEARCH" value="Search"/>
               </td>
            </tr>
         </table>
      </form>
      </div>
      <?php echo $result_tb; ?>
<?php
include 'includes/overall/footer.php'; ?>

Any help is much appreciated

 

aquapetcentre.com

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/295916-search-results-page-displaying-problems/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.