묻고답하기

<?
echo ("
<html>
<head>
<title>
간단게시판</title>
</head>
<body bgcolor=#CDCDBE>
");
if (!$page) {$page=1;}
if ($pagekey==1) {$page--;}
elseif ($pagekey==2) {$page++;}
$MaxNumContents=10;
$connection=mysql_connect("localhost","poketdream","******");
mysql_select_db("*********",$connection);
$result=mysql_query("select*from board1 order by id desc",$connection);
$Total=mysql_num_rows($result);
if(!$Total) {
        echo ("<center><h1>게시판에 등록된 글이 없습니다</h1><center>");
}else{
        echo ("

<center>

<table border=1 cellspacing=1 width=580>
        <tr bgcolor='white'>
        <td align=center><font size='2' color='black'><nobr>
<font face='Arial'>No</font></nobr></font></td>
        <td align=center><font size='2' color='black'><nobr></nobr></font>
        <fint size='2' color='black'><nobr>
        <font face='Arial'>Name</font></nobr></font></td>
        <td align=center><font size='+ '+ '2' color='black'><nobr>
        <font size='Arial'>Subject</font></nobr></font></td>
        <td align=center><font size='2' color='black'><nobr>
        <font face='Arial'>Date</font></nobr></font></td>
        <td align=center><font size='2' color='black'><nobr>
        <font face='Arial'>Hits</font></nobr></font></td></tr>
");
$counter=$MaxnumContents*$page-10;
if($Total>$page*10) {$EndPage=$Page*$MaxNumContents;}
else {$EndPage=$Total;}
while($counter<$EndPage) {
$id=mysql_result($result,$counter,"id");
$writer=mysql_result($result,$counter,"writer");
$topic=mysql_result($result,$counter,"topic");
$wdate=mysql_result($result,$counter,"wdate");
$hit=mysql_result($result,$counter,"hit");
$email=mysql_result($result,$counter,"email");
echo ("
<tr>
        <td align=center><font size='2' color='black'>$id</td>
        <td align=center><font size='2' color='+ 'black'>
        <a href=formmail.php3?email=$email>$writer</a></td>
        <td align=left><nobr><nobr><img src=new.gif>
        <font size='2' color='black'>
        <a href=content.php3?board=$board&page=$page&id=$id>$topic</a></td>
        <td align=center><font size='2' color='black'>$wdate</td>
        <td align=center><font size='2' color='black'>$hit</td><tr>
");
$counter = $counter+1;
endwhile;
}
echo ("
</table><br>
<hr size=1 noshade width=60%>
");
if ($page==1 and $Total<=$MaxNumContents) {echo ("
<a href=input.php3?board=board1&page><img src=write.gif board=0></a>
");
}
elseif($page>1 and $Total>$MaxNumContents) {echo ("
<a href=input.php3?board=board1&page=$page><img src=?write.gif border=0>
        </a> 
<a href=show.php3?board=board1&page=$page&pagekey=2>다음 페이지</a>
        ");
}
elseif($page>1 and $page*$MaxNumContents<$Total) {echo "
<a href=show.php3?board=board1&page=$page&pagekey=1>이전 페이지</a> 
<a href=show.php3?board=board1&page=$page&pagekey=2>다음 페이지</a> 
<a href=input.php3?board=board1&page=$page><img src=http:write.gif border=0>
</a>  ";
}
elseif($page>1 and $page*$MaxNumContents>=$Total) {echo ("
<a href=show.php3?board=board1&page=$page&pagekey=1>이전 페이지</a>&nbdp
<a href=input.php3?board=board1&page=$page><img src=http:write.gif border=0>
        </a> ");
}
echo ("
<center>
</body>
</html>
        ");
?>



while문~endwhile문에서 에러가 납니다.
아니, 정확히 말하자면 endwhile;에서 에러가 나죠
문법에러라고 뜹니다. 하지만 저 부분을


while($counter<$EndPage) {
$id=mysql_result($result,$counter,"id");
$writer=mysql_result($result,$counter,"writer");
$topic=mysql_result($result,$counter,"topic");
$wdate=mysql_result($result,$counter,"wdate");
$hit=mysql_result($result,$counter,"hit");
$email=mysql_result($result,$counter,"email");
echo ("
<tr>
        <td align=center><font size='2' color='black'>$id</td>
        <td align=center><font size='2' color='black'>
        <a href=formmail.php3?email=$email>$writer</a></td>
        <td align=left><nobr><nobr><img src=new.gif>
        <font size='2'+ ' color='black'>
        <a href=content.php3?board=$board&page=$page&id=$id>$topic</a></td>
        <td align=center><font size='2' color='black'>$wdate</td>
        <td align=center><font size='2' color='black'>$hit</td><tr>
");
$counter = $counter+1;
endwhile;
}

이부분을

while($counter<$EndPage);
$id=mysql_result($result,$counter,"id");
$writer=mysql_result($result,$counter,"writer");
$topic=mysql_result($result,$counter,"topic");
$wdate=mysql_result($result,$counter,"wdate");
$hit=mysql_result($result,$counter,"hit");
$email=mysql_result($result,$counter,"email");
echo ("
<tr>
        <td align=center><font size='2' color='black'>$id</td>
        <td align=center><font size='2'+ ' color='black'>
        <a href=formmail.php3?email=$email>$writer</a></td>
        <td align=left><nobr><nobr><img src=new.gif>
        <font size='2' color='black'>
        <a href=content.php3?board=$board&page=$page&id=$id>$topic</a></td>
        <td align=center><font size='2' color='black'>$wdate</td>
        <td align=center><font size='2' color='black'>$hit</td><tr>
");
$counter = $counter+1;
endwhile;


이렇게 바꿔도 안됩니다.


뭐가 잘못된거죠?endwhile문이 잘못된 건가요