비루한 자연계열 학생이
어쩌다가 공대 웹프로그래밍 수업 듣는데
과제로 여기에 주석 달아오라고 하셨거든...
근대 수업시간에도 거의 미술시간마냥 따라하는게 고작이었지
이렇게 과제로 뒤에 주석달아오라고 하니까 뭐 알수가있어야지..
능력자형들 부탁해 ㅠㅠ
<?php
$c "wdb00", "wdb00", "wdb00db");
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>[GuitarWars] Score</title>
</head>
<body>
<h1>Ranking</h1>
<hr />
<?php
$pg = 2; // Number of contents per page
$sql = "SELECT * FROM guitarwars";
$result = mysqli_query($conn, $sql);
$total = mysqli_num_rows($result);
echo "Total " . $total . " contents are selected.<br />\n";
$totalpg = ceil( $total / $pg);
echo "There are " . $totalpg . " pages are exist.<br />\n";
if(!isset($_GET["pno"])) {
$pno = 1;
} else {
$pno = $_GET["pno"];
}
$cph = $pg * ($pno - 1);
$sql = "SELECT * FROM guitarwars ORDER BY score DESC
LIMIT " . $cph . ", " . $pg;
$result = mysqli_query($conn, $sql);
while( $row = mysqli_fetch_array($result) ) {
echo "<h2>" . $row[3] . "</h2>\n";
echo "name : " . $row[2] . "<br />\n";
echo "date : " . $row[1] . "\n";
echo "<hr />";
}
if($pno > 1) {
echo "[<a href='" . $_SERVER["PHP_SELF"] . "?pno=" . ($pno-1) . "'
>Prev</a>]";
}
for($i=1; $i <= $totalpg; $i++) {
if( $i != $pno ) {
echo "[<a href='" . $_SERVER["PHP_SELF"] . "?pno=" . $i ."'>
". $i . "</a>] ";
} else {
echo "[" . $i . "]";
}
}
if($pno < $totalpg ) {
echo "[<a href='" . $_SERVER["PHP_SELF"] . "?pno=" . ($pno+1) . "'
>Next</a>]";
}
mysqli_close($conn);
?>
</body>
</html>
댓글 0