I think there is no use of session while recording page hit :
if ($num_rows== 0){
mysql_query("INSERT INTO counter (id, webpage, visitors) VALUES ('','$webpage','1')");
}else{
// if (!isset($_SESSION['webpage'])){$_SESSION['webpage']= 0; /* you can remove this line */
mysql_query("UPDATE counter SET visitors=visitors+'1' WHERE webpage='$webpage'");}
And while viewing the count, remove some line, as those are useless...
$n=$row['visitors'];
//$l=9-strlen($n); /* you can remove this line */
//$z=substr('',0,$l); /* you can remove this line */
//$c="Counter: ".$z.$n; /* you can remove this line */
$c="Counter: ".$n; /* removed $z */
echo "<div class='counter'>".$c."</div>";
Hope this will help..