Thanx but that didn’t work either. After some debugging it seems the problem stems from the fact that the value of $country is not retained when the user clicks the next button. Can someone be kind enough to show me how to retain the value in $country when the user clicks the next/previous buttons? My code is below:
<?
//connect to server and select database
$conn = mysql_connect("localhost", "root", "")
or die(mysql_error());
mysql_select_db("test",$conn) or die(mysql_error());
$page = (!isset($GET['page']))? '0' : $GET['page'];
$country =(!isset($GET['country']))? '0' : $GET['country'];
echo "This is country: $country";
$sql_text = "SELECT *
FROM userdetails
WHERE country = '$country'
ORDER BY id DESC LIMIT $page,10";
//query one (Get 10 rows)
$myQuery = mysql_query($sql_text);
$myQueryTwo = mysql_query($sql_text);
while ($row = mysql_fetch_assoc($myQuery)) {
echo("<p>\n"
. "<b>job Firstname:</b> " . $row["FIRSTNAME"] . "<br />\n"
. "<b>job Lastname:</b> " . $row["LASTNAME"] . "<br />\n"
. "<b>COUNTRY:</b> " . $row["COUNTRY"] . "<br />\n"
. "<b>contact:</b>\n");
echo("<hr style=\"color:black;width:500px;text-align:left;\">\n\n\n\n");
}
$page = (!isset($GET['page']))? '0' : $GET['page'];
//Pagination below
$numRows = mysql_num_rows($myQueryTwo);//total rows
if(($page-1) < $numRows && $page != 0) {
//display previous
echo '<a href="MLresultsPageFinal6.php?page='.($page-1).'">Previous</a> ';
}
//get Next link
if(($page+1) < $numRows){
echo '|<a href="MLresultsPageFinal6.php?page='.($page+1).'">Next</a>';
}
?>