Jump to content

[SOLVED] My first pagination script!!!


DJTim666

Recommended Posts

I finally coded my first pagination script, and it works @_@. But there is one small problem. Instead of showing the <<Previous link it just shows < 1 2 3 4 5 6 7 8 Next>>

 

Here is a snippet from the code where the problem lies

<?php
if($page > 1){ 
    $prev = ($page - 1); 
    echo "<a href='" . $PHP_SELF . "?page=$prev'><<Previous </a> ";
} 

for($i = 1; $i <= $total_pages; $i++){ 
    if(($page) == $i){ 
        echo "$i "; 
        } else { 
            echo "<a href='" . $PHP_SELF . "?page=$i'>$i</a> "; 
    } 
} 

// Build Next Link 
if($page < $total_pages){ 
    $next = ($page + 1); 
    echo "<a href='" . $PHP_SELF . "?page=$next'> Next>></a>";
} 
?>

 

--

DJ

Link to comment
https://forums.phpfreaks.com/topic/58099-solved-my-first-pagination-script/
Share on other sites

  • 1 month later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.