php pagination getting error
<p>hello i am new to php i am geeting this error</p>

<pre><code>Notice: Undefined variable: page_pagination in K:\PHP WAMP\wamp\www\Oracle Certified Masters\Oracle Certified Masters\includes\middle.php on line 82
</code></pre>

<p>and here is my sample code..
 plz help me..</p>

<pre><code>&lt;?php


// how many rows to show per page
$rowsPerPage = 10;

// by default we show first page
$page_num = 1;

// if $_GET['page'] defined, use it as page number, $_GET gets the page number out of the url
//set by the $page_pagination below
if(isset($_GET['page'])){$page_num = $_GET['page'];}

//the point to start for the limit query
$offset = $page_num;
$page_pagination;
// Zero is an incorrect page, so switch the zero with 1, mainly because it will cause an error with the SQL
if($page_num == 0) {$page_num = 1;}

// counting the offset


$sql = "SELECT QUERY Limit $offset, $rowsPerPage ";
$res = mysql_query($sql) or die(mysql_error());

// how many rows we have in database
$sql2  = "SELECT COUNT(sub_ID) AS numrows FROM posts ";
$res2  = mysql_query($sql2) or die(mysql_error());
$row2  = mysql_fetch_array($res2);
$numrows = $row2['numrows'];

// print the random numbers
while($row = mysql_fetch_array($res))
{
    //Echo out your table contents here.

    echo $row[1].'&lt;BR&gt;';
    echo $row[2].'&lt;BR&gt;';
    echo '&lt;BR&gt;';
}

// how many pages we have when using paging?
$numofpages = ceil($numrows/$rowsPerPage);

// print the link to access each page
$self = "index.php?";

if ($numofpages &gt; '1' ) {

    $range =15; //set this to what ever range you want to show in the pagination link
    $range_min = ($range % 2 == 0) ? ($range / 2) - 1 : ($range - 1) / 2;
    $range_max = ($range % 2 == 0) ? $range_min + 1 : $range_min;
    $page_min = $page_num- $range_min;
    $page_max = $page_num+ $range_max;

    $page_min = ($page_min &lt; 1) ? 1 : $page_min;
    $page_max = ($page_max &lt; ($page_min + $range - 1)) ? $page_min + $range - 1 : $page_max;
    if ($page_max &gt; $numofpages) {
        $page_min = ($page_min &gt; 1) ? $numofpages - $range + 1 : 1;
        $page_max = $numofpages;
    }

    $page_min = ($page_min &lt; 1) ? 1 : $page_min;

    //$page_content .= '&lt;p class="menuPage"&gt;';

    if ( ($page_num &gt; ($range - $range_min)) &amp;&amp; ($numofpages &gt; $range) ) {
        $page_pagination .= '&lt;a class="num"  title="First" href="'.$self.'page=1"&gt;&amp;lt;&lt;/a&gt; ';
    }

    if ($page_num != 1) {
        $page_pagination .= '&lt;a class="num" href="'.$self.'page='.($page_num-1). '"&gt;Previous&lt;/a&gt; ';
    }

    for ($i = $page_min;$i &lt;= $page_max;$i++) {
        if ($i == $page_num)
        $page_pagination .= '&lt;span class="num"&gt;&lt;strong&gt;' . $i . '&lt;/strong&gt;&lt;/span&gt; ';
        else
        $page_pagination.= '&lt;a class="num" href="'.$self.'page='.$i. '"&gt;'.$i.'&lt;/a&gt; ';
    }

    if ($page_num &lt; $numofpages) {
        $page_pagination.= ' &lt;a class="num" href="'.$self.'page='.($page_num + 1) . '"&gt;Next&lt;/a&gt;';
    }


    if (($page_num&lt; ($numofpages - $range_max)) &amp;&amp; ($numofpages &gt; $range)) {
        $page_pagination .= ' &lt;a class="num" title="Last" href="'.$self.'page='.$numofpages. '"&gt;&amp;gt;&lt;/a&gt; ';
    }

    //$page['PAGINATION'] ='&lt;p id="pagination"&gt;'.$page_pagination.'&lt;/p&gt;';
}//end if more than 1 page

echo $page_pagination.'&lt;BR&gt;&lt;BR&gt;';

echo 'Number of results - '.$numrows ;
echo ' and Number of pages   - '.$numofpages.'&lt;BR&gt;&lt;BR&gt;';

// Free resultset
//mysql_free_result($res);

// and close the database connection
//mysql_close($con);

?&gt;
</code></pre>
