<table>
<tr>
<?php
$ii = 1;
$query="select COUNT(*) from 테이블 명 where 조건";
$result=mysql_query($query);
$total=mysql_result($result, 0, 0);
$board_info['lists'] = '16'; // 12개를 구함 4 * 3
$board_info['rows'] = '10'; // 페이징 리스트 10개
list($begin, $page) = page_begin($page, $total, $board_info['lists']);
$Link = ""; // 조건들
$total_page = ceil($total / $board_info['lists']);
$direct_page = page_cut($page, $total_page, $board_info['rows'], $Link, 'board', 'center'); // 리스트
$query="select * from 테이블 명 where 조건 order by no desc LIMIT 12";
$result=mysql_query($query);
while($row=mysql_fetch_array($result)) {
$no=$row[no];
$gid=$row[gid];
$reg_name=$row[reg_name];
$reg_gisu=$row[reg_gisu];
?>
<td>
<table cellspacing=0 bordercolordark=#ffffff cellpadding=3 width=100 bordercolorlight=#dcdcdc border=1 >
<tr><td>이름: <?=$reg_name ?></td></tr>
<tr><td>기수 : <?= $reg_gisu ?> 기 </td></tr>
</table>
</td>
< ?php
if(!strcmp(($ii % 4), '0')) { // 가로가 4개면 다음줄로
?>
</tr>
< tr>
<?php
$ii = 1;
} else {
$ii++;
}
}
?>
// 함수
<?php
/* ============================================================================
Return :
Comment: 페이징
Usage :
------------------------------------------------------------------------------*/
function page_begin( $page, $total, $scale )
{
if(empty($page) && $page < 1) {
$page = 1;
}
if(empty($total) && $total < 1) {
$begin = 0;
} else {
$begin = $scale * ($page - 1);
}
return array($begin, $page);
}
function page_cut( $page, $total_page, $scale, $link, $images, $align )
{
if($total_page < 1)
$total_page = 1;
$first_page = (((int)(($page - 1) / $scale)) * $scale) + 1;
$last_page = $first_page + $scale - 1;
if($last_page >= $total_page)
$last_page = $total_page;
$url = $PHP_SELF ."?page=";
$str = "";
if($first_page > 1) {
$str .= "◀";
} else {
$str .= "◀";
}
$str .= " ";
if($scale > 1) {
for($i = $first_page; $i <= $last_page; $i++) {
if($page != $i) {
if($i == $last_page)
$str .= "<A Href='". $url . $i ."&". $link ."'>". $i ."</A>";
else
$str .= "<A Href='". $url . $i ."&". $link ."'>". $i ."</A> | ";
} else {
if($i == $last_page)
$str .= "<Strong>". $i ."</Strong>";
else
$str .= "<Strong>". $i ."</Strong> | ";
}
}
}
$str .= " </Td>";
if($total_page > $last_page) {
$str .= "▶";
} else {
$str .= "▶";
}
return $str;
}
?>
<tr>
<?php
$ii = 1;
$query="select COUNT(*) from 테이블 명 where 조건";
$result=mysql_query($query);
$total=mysql_result($result, 0, 0);
$board_info['lists'] = '16'; // 12개를 구함 4 * 3
$board_info['rows'] = '10'; // 페이징 리스트 10개
list($begin, $page) = page_begin($page, $total, $board_info['lists']);
$Link = ""; // 조건들
$total_page = ceil($total / $board_info['lists']);
$direct_page = page_cut($page, $total_page, $board_info['rows'], $Link, 'board', 'center'); // 리스트
$query="select * from 테이블 명 where 조건 order by no desc LIMIT 12";
$result=mysql_query($query);
while($row=mysql_fetch_array($result)) {
$no=$row[no];
$gid=$row[gid];
$reg_name=$row[reg_name];
$reg_gisu=$row[reg_gisu];
?>
<td>
<table cellspacing=0 bordercolordark=#ffffff cellpadding=3 width=100 bordercolorlight=#dcdcdc border=1 >
<tr><td>이름: <?=$reg_name ?></td></tr>
<tr><td>기수 : <?= $reg_gisu ?> 기 </td></tr>
</table>
</td>
< ?php
if(!strcmp(($ii % 4), '0')) { // 가로가 4개면 다음줄로
?>
</tr>
< tr>
<?php
$ii = 1;
} else {
$ii++;
}
}
?>
// 함수
<?php
/* ============================================================================
Return :
Comment: 페이징
Usage :
------------------------------------------------------------------------------*/
function page_begin( $page, $total, $scale )
{
if(empty($page) && $page < 1) {
$page = 1;
}
if(empty($total) && $total < 1) {
$begin = 0;
} else {
$begin = $scale * ($page - 1);
}
return array($begin, $page);
}
function page_cut( $page, $total_page, $scale, $link, $images, $align )
{
if($total_page < 1)
$total_page = 1;
$first_page = (((int)(($page - 1) / $scale)) * $scale) + 1;
$last_page = $first_page + $scale - 1;
if($last_page >= $total_page)
$last_page = $total_page;
$url = $PHP_SELF ."?page=";
$str = "";
if($first_page > 1) {
$str .= "◀";
} else {
$str .= "◀";
}
$str .= " ";
if($scale > 1) {
for($i = $first_page; $i <= $last_page; $i++) {
if($page != $i) {
if($i == $last_page)
$str .= "<A Href='". $url . $i ."&". $link ."'>". $i ."</A>";
else
$str .= "<A Href='". $url . $i ."&". $link ."'>". $i ."</A> | ";
} else {
if($i == $last_page)
$str .= "<Strong>". $i ."</Strong>";
else
$str .= "<Strong>". $i ."</Strong> | ";
}
}
}
$str .= " </Td>";
if($total_page > $last_page) {
$str .= "▶";
} else {
$str .= "▶";
}
return $str;
}
?>