웹마스터 팁

<html>
<head>
<style>

<!--

input { text-align:center; border-width:0; border-style:none; }

*{ font-family:굴림; font-size:9pt; text-decoration:none;}

a:link { color:black; text-decoration:none; }

a:visited { color:black; text-decoration:none; }

a:active { color:black; text-decoration:none; }

a:hover { color:black; text-decoration:none; }



td { text-align:center; margin:0; padding:0; }

-->

</style>

<meta http-equiv="content-type" content="text/html; charset=euc-kr">
<title>순위</title>
<meta name="generator" content="Namo WebEditor v5.0(Trial)">
</head>

<body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">
<?

   include "config.php";
       ?>
<br> <table width="655" border="1" cellspacing="0" bordercolordark="white" bordercolorlight="#9966FF" bordercolor="#9999FF" align="center">

              <tr>

                <td width="30" bgcolor="#6699FF" height="25">
            <p align="center">순위</td>

                <td bgcolor="#99CCFF" height="25">
            <p align="center">팀명</td>

                <td bgcolor="#99CCFF" height="25">
            <p align="center">성명</td>

                <td bgcolor="#99CCFF" height="25">
            <p align="center">경기수</td>

                <td bgcolor="#99CCFF" height="25">
            <p align="center">타석</td>

                <td bgcolor="#99CCFF" height="25">
            <p align="center">타수</td>

                <td bgcolor="#99CCFF" height="25">
            <p align="center"><a href=list.php?sort=2>안타</a></td>

                <td bgcolor="#99CCFF" height="25">
            <p align="center"><a href=list.php?sort=3>홈런</a></td>

                <td bgcolor="#99CCFF" height="25">
            <p align="center">사사구</td>

                <td bgcolor="#99CCFF" height="25">
            <p align="center">타점</td>

                <td bgcolor="#99CCFF" height="25">
            <p align="center"><a href=list.php?sort=1>타율</a></td>

                <td bgcolor="#99CCFF" height="25">
            <p align="center">출루율</td>

                <td bgcolor="#99CCFF" height="25">
            <p align="center"><a href=list.php?sort=4>투수승</a></td>

                <td bgcolor="#99CCFF" height="25">
            <p align="center">선수</td>

              </tr>
<?
$ret="select * from score";
$no=0;
if ($sort==1)
{
$ret="select * from score order by data7 desc";
}
if ($sort==2)
{
$ret="select * from score order by data3 desc";
}
if ($sort==3)
{
$ret="select * from score order by data4 desc";
}
if ($sort==4)
{
$ret="select * from score order by data9 desc";
}
$result=mysql_query($ret);

$total = mysql_affected_rows();

while($data=mysql_fetch_array($result))

{
        $no=$no+1;
?>
    <tr>
                <td width="30" bgcolor="#6699FF" height="25">
            <p align="center"><?=$no?></p>
</td>

                <td bgcolor="white" height="25">
            <p align="center"><?=$data[team]?></p>
</td>

                <td bgcolor="white" height="25">
            <p align="center">
            
            <?
            echo $data[name];
            if ($member[level]==1)
            {
               echo "<a href=edit.php?no=$data[no]>+</a>";
               echo "<a href=del.php?no=$data[no]>-</a>";
            }
            
            ?></p>
</td>

                <td bgcolor="white" height="25">
            <p align="center"><?=$data[data1]?></p>
</td>

                <td bgcolor="white" height="25">
            <p align="center"><?=$data[data2]?></p>
</td>

                <td bgcolor="white" height="25">
            <p align="center"><?=$data[data21]?></p>
</td>

                <td bgcolor="white" height="25">
            <p align="center"><?=$data[data3]?></p>
</td>

                <td bgcolor="white" height="25">
            <p align="center"><?=$data[data4]?></p>
</td>

                <td bgcolor="white" height="25">
            <p align="center"><?=$data[data5]?></p>
</td>

                <td bgcolor="white" height="25">
            <p align="center"><?=$data[data6]?></p>
</td>

                <td bgcolor="white" height="25">
            <p align="center"><?=$data[data7]?></p>
</td>

                <td bgcolor="white" height="25">
            <p align="center"><?=$data[data8]?></p>
</td>

                <td bgcolor="white" height="25">
            <p align="center"><?=$data[data9]?></p>
</td>

                <td bgcolor="white" height="25">
            <p align="center"><?=$data[data10]?></p>
</td>

    </tr>
    <?
    }
    ?>
</table>
<? if ($member[level]==1)
{
?>
<p align="center"><a href="input.php">데이터 입력하기</a></p>
<?
}
?>
</body>

</html>

목록 보기는 단순한 mysql를 펼쳐 보여 주는 화면입니다.
항상 목록 보기에서 mysql를 가져 올때 반복되는 루틴은 있습니다.

<?
$ret="select * from score";
$no=0;
if ($sort==1)
{
$ret="select * from score order by data7 desc";
}
if ($sort==2)
{
$ret="select * from score order by data3 desc";
}
if ($sort==3)
{
$ret="select * from score order by data4 desc";
}
if ($sort==4)
{
$ret="select * from score order by data9 desc";
}
$result=mysql_query($ret);

$total = mysql_affected_rows();

while($data=mysql_fetch_array($result))

{

반복 출력될 화면

}

그리고 if문은 보시면 타율등을 클릭할때 입력 역순으로 보여 주던 것을 상황에 따라 ($sort 변수) 정렬을 나타내도록 되어 있습니다.
각 데이터는 $data[필드명] 이부분이 mysql에서 가져온 데이터의 변수 입니다.
제목 글쓴이 날짜
기초 통계 프로그램 for 귀차니스트;; [3] TheMics 2002.08.10
Print 이건또 뭐지? 사이트 찾다보니 있던데..^^ [13] ZipShin 2002.08.16
제로 카운터 숫자 조정하기 [8] 이주경 2002.08.21
누구나 만들수있는 게시판 [schema, write, write_ok] [10] Mr. JH 2002.08.21
누구나 만들수있는 게시판 [글목록 list.php 부분] [6] Mr. JH 2002.08.21
누구나 만들수있는 게시판 [글보기 view.php 부분] [1] Mr. JH 2002.08.21
누구나 만들수있는 게시판 [글삭제, 수정 부분] [4] file Mr. JH 2002.08.21
테이블 생성시 데이터베이스의 타입설정 [2] Mr. JH 2002.08.22
꼭 알아야 하는 4가지 쿼리문 Mr. JH 2002.08.22
PHP에서 사용하는 간단하지만 중요한 MySQL함수들 [3] Mr. JH 2002.08.22
PHP 시간관련 함수 [3] Mr. JH 2002.08.22
PHP의 제어구조 [2] Mr. JH 2002.08.22
파일하나로 만드는 한줄 메모장(테마기능 포함) [8] Mr. JH 2002.08.22
[허접] rand() 함수를 이용한 뒤죽박죽 날짜 출력 [5] Myzzix 2002.08.23
[허접] implode() 함수로 배열을 변수로! Myzzix 2002.08.23
sleep() 제대루 쓰기... 요것두 [별루 알아도 도움 안되는 팁] [5] sMokaHallo 2002.08.24
변수를 사용하여 echo로 변수값 출력하기. [7] ZipShin 2002.08.28
array_multisort를 이용한 간단한 순위체크 [4] Doogi 2002.08.28
초보의 php를 활용한 OneFrame(NoFrame) 홈페이지 만들기 - 1 [17] 아이쿠 2002.08.30
초보의 php를 활용한 OneFrame(NoFrame) 홈페이지 만들기 - 2 [11] 아이쿠 2002.08.30