kodların tamamı burda, yardımlarınız için teşekkürler... bunada bi yardım lütfen

<?php
include("config.php");

$result = mysql_query("SELECT * FROM config order by id");
while($r=mysql_fetch_array($result))
{
$wi=$r["wi"];
$hi=$r["hi"];
}
$idp = $_GET['id'];
$kindo = "id";
$result = mysql_query("SELECT * FROM cat WHERE $kindo LIKE '$idp'");
while($r=mysql_fetch_array($result))
{
$catname=$r["name"];
}
$max_results = 5;
 

if(!isset($_GET['page'])){
    $page = 1;
 $num = "1";
} else {
    $page = $_GET['page'];
 $num = (($page - 1) * $max_results  + 1);
}

$from = (($page * $max_results) - $max_results);
 

$stu = "cat";
$sql = mysql_query("SELECT * FROM post  WHERE $stu LIKE '$catname' ORDER BY id DESC LIMIT $from, $max_results"); 
while($row = mysql_fetch_array($sql))
{ 
$postname = $row['name'];
$ida = $row['id'];
$date = $row['date'];
$visit = $row['visit'];
$cat = $row['cat'];
$text = $row['text'];
$how = $row['comments'];
$comment = "0";
$pop = "post";
if ($how == "y"){
$result = mysql_query("SELECT * FROM comments WHERE $pop LIKE '$ida'");
while($r=mysql_fetch_array($result))
{
$comment = ($comment + "1");
}
}else{
$comment = "Closed";
}
 
echo "<table cellpadding='0' cellspacing='0'>
<tr>";
$result = mysql_query("SELECT * FROM images WHERE $pop LIKE '$ida' ORDER BY id ASC LIMIT 1");
while($r=mysql_fetch_array($result)){
$img=$r["url"];
echo "<td valign=top align=center><a  href='show.php?id=$ida'><img border='0' src="; echo "$img";
echo " width='$wi' height='$wi'><br>$postname</a><br>$text</td>";
    $listele++;
    if($listele ==4){
    echo "</tr><tr>";
    $listele=0;
    }
}
echo "</table>";

}

echo "
<table cellpadding='0' cellspacing='0' width='400' height='29' id='table2'>
 <tr>
  <td valign='middle' align=center height='17' style='font-family: Tahoma; font-size: 8pt; border-top: 1px dotted ; border-bottom: 1px dotted' bgcolor='#F5F5F5'>
  &nbsp;Sayfalar :&nbsp;";
$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM post"),0);
// Figure out the total number of pages. Always round up using ceil()
$total_pages = ceil($total_results / $max_results);
// Build Previous Link
if($page > 1){
    $prev = ($page - 1);
    echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$prev\" style='text-decoration: none'><span lang='fa'><font face='Tahoma' style='font-size: 8pt'>«</font></a> ";
}
for($i = 1; $i <= $total_pages; $i++){
    if(($page) == $i){
        echo "<span lang='fa'><font face='Tahoma' style='font-size: 7pt'><b>$i  </b></font>";
        } else {
            echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$i\" style='text-decoration: none'><span lang='fa'><font face='Tahoma' style='font-size: 7pt'>$i</font></a> ";
    }
}
// Build Next Link
if($page < $total_pages){
    $next = ($page + 1);
    echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$next\" style='text-decoration: none'><span lang='fa'><font face='Tahoma' style='font-size: 8pt'>»</font></span></a>";
}
echo "</td>
 </tr>
 <tr>
  <td valign='top' height='6' width='400'>
  <img border='0' src='images/spacer.gif' width='1' height='1'></td>
 </tr>
</table>";
?>