Hello,
In my script me main query is like this.....notice I am trying to order the results based on 'featured'.
<?php
if(!isset($start)) $start = 0;
$result = @("SELECT town, list_price, bedrooms, baths, rooms, Id ,IF (lister_office_name like
'Century 21', 1, 0)
AS featured
FROM residential
WHERE town like '%$selecttown'
AND list_price like '%$selectprice'
AND bedrooms like '%$bedroomsel'
AND baths like '%$bathselect'
ORDER BY featured
DESC LIMIT " . $start . ", 10");
if (!$result) {
echo("<p>Error performing query: " . mysql_error() . "</p>");
exit();
}
while ($row = mysql_fetch_array($result)) // this will grab the results from query
{
?>
To paginate the listings I am using the following code...
<?
$query = "SELECT count(*) as count FROM residential";
$result2 = mysql_query($query);
$row = mysql_fetch_array($result2);
$numrows = $row['count'];
if($start > 0)
echo "<a href=\"" . $PHP_SELF . "?start=" . ($start - 10) .
"\">Previous 10 Listings</a>
\n";
if($numrows > ($start + 10))
echo "<a href=\"" . $PHP_SELF . "?start=" . ($start + 10) .
"\">Next 10 Listings</a>\n";
?>
This seems to be working...the issue is, then I click on 'Next 10 Listings' the pagination seems to be loosing the "main query".
I also have a search form as an include.
Can you help?