<?php

//db 연결 부분입니다.
$con=mysql_connect("localhost", "root", "") or die (mysql_error()); //hostname,id,password
if(!$con){
	echo("not connected:".mysql_error());
}
$db_con=mysql_select_db("finger"); //db이름
if(!$db_con){
	echo("can't use db : ".mysql_error());
}

echo("
<center>
<table>
<tr>
<td><img src=./img/icon.png></td>
<td><b>Finger Hurdle Top 20!!</b></td></tr>
</table>
</center>
<br><br>");



$sql ="select * from runner order by meter desc limit 20";
$result=mysql_query($sql);
$i = 0;

echo("
<center><table border=0 bgcolor=#c0c0ff cellspacing=0 cellpadding=2>
<tr><td align=center valign=middle>
    <table border=0 cellspacing=1 cellpadding=1 bordercolor=black width=100% bgcolor=white>
        <tr bgcolor= #8080ff >
            <td><font color=#ffffff>rank</td>
            <td><font color=#ffffff>M
            </td>
            <td><font color=#ffffff>name</td>

            <td><font color=#ffffff>time</td>
        </tr>");


while($row=mysql_fetch_array($result)){
    $i++;
    $name= $row['name'];
    $meter = $row['meter'];
    $date = $row['date'];
    echo "<tr>";
    echo "<td align=right>$i</td>";
    echo "<td align=right>$meter</td>";
    echo "<td align=right>$name</td>";
    echo "<td align=center>$date</td>";
    echo "</tr>";
}

echo "</table></center>";

?>