Jump to content

aquapetcentre

New Members
  • Posts

    5
  • Joined

  • Last visited

aquapetcentre's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, I have the following page containing the search engine. All works fine, except for the face that it retrieves the information from the database, and displays each result 3 times. Have no idea why this is happening when my other search results are fine <?php include 'init.php'; // normal search $result_tb = ""; if (!empty($_POST['SEARCH']) && !empty($_POST['search_value'])) { $e = $_POST['search_value']; $query = "SELECT aquaticCenterName, town, county FROM reviews WHERE CONCAT_WS(' ', aquaticCenterName, town, county) LIKE '%$e%'"; $query_result = $con->query($query); $result_tb = '<div><h2>Aquatic Center Name:</h2>'; while ($rows = $query_result->fetch_assoc()) { foreach ($rows as $k => $v) { $u = $rows['aquaticCenterName']; $r = $rows['town']; $s = $rows['county']; $t = urlencode($r); // since this is a text name, make it url encoded $z = urlencode($s); // since this is a text name, make it url encoded $v = urlencode($u); // since this is a text name, make it url encoded $result_tb .= "<hr> <a href='reviewResults.php?aquaticCenterName=$v'><strong><p1>Aquatic Centre Name:</strong> $u - <strong>Town:</strong> $t - <strong>County:</strong> $z</a></p1><br>"; } } $result_tb .='</div>'; $con->close(); } ?> <?php include 'init.php'; include 'includes/overall/header.php'; ?> </br> <div class="centerDiv"> <h4>Search Aquatic Center Reviews</h4> <p>Want to find the best aquatic centre in your area? You can search via store name, town or county.</p> <p>Alternatively <a href="leaveReview.php">Click Here</a> to leave a review.</p> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <p class="register"> <input type="text" name="search_value" size="30" maxlength="30" value="Search for store name, town or county"/> <input type="submit" name="SEARCH" value="Search"/> </p> </form> </div> <?php echo $result_tb; ?> <?php include 'includes/overall/footer.php'; Please help!!! http://www.aquapetcentre.com
  2. 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
×
×
  • 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.