Hi Guys,
Done some research on FOUND_ROWS(), and thought this may work. However this says in my db of 31 records;
On Page 1
Your search returned 25 result(s). //Wrong!
On Page 1
Your search returned 31 result(s). //Right!!!
Even more bizzare!
Any help please?
PHP Code:
// Start to find how many search results are being found for the query
$search_query .= $add . " LIMIT " . $limitvalue . ", " . $limit;
$search_results = mysql_query($search_query, $can_i_connect);
$result = mysql_query($search_query) or die (mysql_error());
// Figure out the total number of results in DB:
$total_results = mysql_result(mysql_query("SELECT FOUND_ROWS()"), 0);
if($total_results <= 0)
{
echo "Sorry, there were no results for your search .";
}
// Else and Start to find how many pagination pages I have
else
{
echo "<b>Your search returned ".$total_results." result(s).</b> <br /><br />Here are those results, listed in ascendng order. <br /><br />";
if($page != 1){
$pageprev = $page - 1;
echo("<a href=\"$PHP_SELF?page=$pageprev\">PREV</a> ");
}else{
echo("PREV");
}
$numofpages = $number_of_results/ $limit;
#echo "<br>", $totalrows;
#exit;
for($i = 1; $i <= $numofpages; $i++){
if($i == $page){
echo($i." ");
}else{
echo("<a href=\"$PHP_SELF?page=$i\">$i</a> ");
}
}
if(($totalrows % $limit) != 0){
if($i == $page){
echo($i." ");
}else{
echo("<a href=\"$PHP_SELF?page=$i\">$i</a> ");
}
}
if(($totalrows - ($limit * $page)) > 0){
$pagenext = $page + 1;
echo("<a href=\"$PHP_SELF?page=$pagenext\">NEXT</a>");
}else{
echo("NEXT");
}
} // End of how many results I have found
mysql_free_result($result);
// End of Else and to find how many pagination pages I have
Bookmarks