웹마스터 팁
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
야구 자료실 2 (목록 만들기)
2003.02.02 18:33
<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에서 가져온 데이터의 변수 입니다.
<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에서 가져온 데이터의 변수 입니다.