[PHP & MySQL] Pagination Help!

I’m having some problems with a tutorial that I found from phpfreaks. It doesnt seem to be showing links at the bottom of the page and what not. It shows page one, but with no hyperlink.

Here is the code:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?php 

    @mysql_connect('localhost', 'portfolio', '**') or die("ERROR--CAN'T CONNECT TO SERVER"); 
    @mysql_select_db(portfolio) or die("ERROR--CAN'T CONNECT TO DB"); 

    $limit          = 7;                
    $query_count    = "SELECT count(*) FROM news";     
    $result_count   = mysql_query($query_count);     
    $totalrows      = mysql_num_rows($result_count); 

    if(empty($page)){ 
        $page = 1; 
    } 
         

    $limitvalue = $page * $limit - ($limit); 
    $query  = "SELECT * FROM news LIMIT $limitvalue, $limit";         
    $result = mysql_query($query) or die("Error: " . mysql_error()); 

    if(mysql_num_rows($result) == 0){ 
        echo("Nothing to Display!"); 
    } 

    #$bgcolor = "#E0E0E0"; // light gray 

    echo("<table>"); 
     
   	while ($row = mysql_fetch_array ($result)) {
		//echo '<center>';
		echo "<div id=\"entrytitle\">{$row['title']} - {$row['date_entered']}</div>";
		echo "<div id=\"entrycontent\">{$row['entry']}</div><br />";
		//echo '</center>';
	}

    if($page != 1){ 
        $pageprev = $page--; 
         
        echo("<a target=\"frame\" href=\"$PHP_SELF&page=$pageprev\">PREV".$limit."</a>&nbsp;"); 
    }else{ 
        echo("PREV".$limit."&nbsp;"); 
    } 

    $numofpages = $totalrows / $limit; 
     
    for($i = 1; $i <= $numofpages; $i++){ 
        if($i == $page){ 
            echo($i."&nbsp;"); 
        }else{ 
            echo("<a target=\"frame\" href=\"$PHP_SELF?page=$i\">$i</a>&nbsp;"); 
        } 
    } 


    if(($totalrows % $limit) != 0){ 
        if($i == $page){ 
            echo($i."&nbsp;"); 
        }else{ 
            echo("<a target=\"frame\" href=\"$PHP_SELF?page=$i\">$i</a>&nbsp;"); 
        } 
    } 

    if(($totalrows - ($limit * $page)) > 0){ 
        $pagenext = $page++; 
          
        echo("<a target=\"frame\" href=\"$PHP_SELF?page=$pagenext\">NEXT".$limit."</a>"); 
    }else{ 
        echo("NEXT".$limit); 
    } 
     
    mysql_free_result($result); 

?> 
</body>
</html>