The next page is not shown in pagination
<p>I have done pagination in my pg_management.php file that displays all records stored in database. The problem is When I move to next page , the next page is not shown. When i move my pointer over the link, the link is not hovered.</p>

<p>Below is my code for pagination </p>

<pre><code>&lt;?php 

    &lt;?php   $tbl_name=$db_prefix."pages";
        $adjacents = 3;
        $query = "SELECT COUNT(*) as num FROM $tbl_name";
        $total_pages = mysql_fetch_array(mysql_query($query));
        $total_pages = $total_pages['nu

    m'];
        $targetpage = "pg_management.php"; 
        $limit = 2; 
        $page = 15;
        if($page) 
            $start = ($page - 1) * $limit;  
            else
            $start = 0;



    $sql = "SELECT page_name, status FROM $tbl_name LIMIT $start, $limit";
            $result = mysql_query($sql);
            if ($page == 0) $page = 1;
            $prev = $page - 1;
            $next = $page + 1;
            $lastpage = ceil($total_pages/$limit);
            $lpm1 = $lastpage - 1;
            $pagination = "";
    if($lastpage &gt; 1)


    {   
            $pagination .= "&lt;div class='pagination'&gt;";

             if ($page &gt; 1) 
                $pagination.= "&lt;a href='$targetpage?page=$prev'&gt;previous&lt;/a&gt;";
            else
                $pagination.= "&lt;span class='disabled'&gt;previous&lt;/span&gt;"; 

                if ($lastpage &lt; 7 + ($adjacents * 2))

                {   
                for ($counter = 1; $counter &lt;= $lastpage; $counter++)
                {
                    if ($counter == $page)
                        $pagination.= "&lt;span class=\"current\"&gt;$counter&lt;/span&gt;";
                    else
                        $pagination.= "&lt;a href=\"$targetpage?page=$counter\"&gt;$counter&lt;/a&gt;";                 
                }


                }
            elseif($lastpage &gt; 5 + ($adjacents * 2))

            {
                if($page &lt; 1 + ($adjacents * 2))        
                {
                    for ($counter = 1; $counter &lt; 4 + ($adjacents * 2); $counter++)



{
                    if ($counter == $page)
                        $pagination.= "&lt;span class=\"current\"&gt;$counter&lt;/span&gt;";
                    else
                        $pagination.= "&lt;a href=\"$targetpage?page=$counter\"&gt;$counter&lt;/a&gt;";                 
                }
                $pagination.= "...";
                $pagination.= "&lt;a href=\"$targetpage?page=$lpm1\"&gt;$lpm1&lt;/a&gt;";


    $pagination.= "&lt;a href=\"$targetpage?page=$lastpage\"&gt;$lastpage&lt;/a&gt;";       
                    }

                    elseif($lastpage - ($adjacents * 2) &gt; $page &amp;&amp; $page &gt; ($adjacents * 2))
                    {
                        $pagination.= "&lt;a href=\"$targetpage?page=1\"&gt;1&lt;/a&gt;";
                        $pagination.= "&lt;a href=\"$targetpage?page=2\"&gt;2&lt;/a&gt;";
                        $pagination.= "...";
                        for ($counter = $page - $adjacents; $counter &lt;= $page + $adjacents; $counter++)
                        {
                            if ($counter == $page)
                                $pagination.= "&lt;span class=\"current\"&gt;$counter&lt;/span&gt;";

                                else


$pagination.= "&lt;a href=\"$targetpage?page=$counter\"&gt;$counter&lt;/a&gt;";                 
                    }
                    $pagination.= "...";
                    $pagination.= "&lt;a href=\"$targetpage?page=$lpm1\"&gt;$lpm1&lt;/a&gt;";

                    $pagination.= "&lt;a href=\"$targetpage?page=$lastpage\"&gt;$lastpage&lt;/a&gt;";       
                }

            else
            {
                $pagination.= "&lt;a href=\"$targetpage?page=1\"&gt;1&lt;/a&gt;";
                $pagination.= "&lt;a href=\"$targetpage?page=2\"&gt;2&lt;/a&gt;";
                $pagination.= "...";
                for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter &lt;= $lastpage; $counter++)

                {
                    if ($counter == $page)
                        $pagination.= "&lt;span class=\"current\"&gt;$counter&lt;/span&gt;";
                    else
                        $pagination.= "&lt;a href=\"$targetpage?page=$counter\"&gt;$counter&lt;/a&gt;";                 
                }
            }
        }

        if ($page &lt; $counter - 1) 
            $pagination.= "&lt;a href=\"$targetpage?page=$next\"&gt;next &lt;/a&gt;";
        else
            $pagination.= "&lt;span class=\"disabled\"&gt;next &lt;/span&gt;";
        $pagination.= "&lt;/div&gt;\n";       
    }
    ?&gt;
</code></pre>

<p>Below is syntax to print pagination</p>

<pre><code>&lt;?php echo $pagination; ?&gt; 
</code></pre>

<p>This is my css file</p>

<pre><code>div.pagination
 {
font-family:Tahoma, Geneva, sans-serif;
    padding: 3px;
    margin: 3px;
}

div.pagination a 
{
    padding:2px 5px 2px 5px;
    margin:2px;
    border:1px solid #999;
    text-decoration:none;
    color: #666;
}

div.pagination a:hover, .pagination a:active 
{
    border: 1px solid #999;
    color: #000;
}

div.pagination span.current
 {
    margin: 2px;
    padding: 2px 5px 2px 5px;
    border: 1px solid #999;

        font-weight: bold;
        background-color: #999;
        color: #FFF;
    }

 div.pagination span.disabled {
        padding:2px 5px 2px 5px;
        margin:2px;
        border:1px solid #eee;
        color:#DDD;
    }
</code></pre>
