I’m displaying 10 records per page. The variables I have currently that I’m working with are..
$total = total number of records
$page = whats the current page I'm displaying
I placed this at the top of my page…
if ( $_GET['page'] == '' ) { $page = 1; } //if no page is specified set it to `1`
else { $page = ($_GET['page']); } // if page is specified set it
Here are my two links…
if ( $page != 1 ) { echo '<div style="float:left" ><a href="index.php?page='. ( $page - 1 ) .'" rev="prev" >Prev</a></div>'; }
if ( !( ( $total / ( 10 * $page ) ) < $page ) ) { echo '<div style="float:right" ><a href="index.php?page='. ( $page + 1 ) .'" rev="next" >Next</a></div>'; }
Now I guess (unless I’m not thinking of something) that I can display the “Prev” link every time except when the page is ‘1’. How can make it where the “Next” link doesn’t show on the last page though?
replace your last line of code with: