1) { $page_count = ceil($page/$page_scale); $start_page = ($page_count-1)*$page_scale+1; $end_page = $start_page + $page_scale-1; if ($end_page > $total_pages){ $end_page = $total_pages; } } $query = "select * from `freeboard` where `is_comment` = 0 order by `thread` desc limit $start, $list_scale"; $result = mysql_query($query, $dbconn); for($i=$total-(($page-1)*$list_scale); $list=mysql_fetch_array($result); $i--){ // 답글일 경우 띄워 쓰기 $reply = ""; $reply2 = ""; for($a = 0; $a < $list[depth]; $a++) $reply.="    "; if($list[depth] > 0) $reply2="[답글]"; if($list[comment_num] > 0) $list[title].= "($list[comment_num])"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } ?>
글번호 제목 작성자 날짜 조회수
$i $reply $reply2 $list[title] $list[name] $list[date] $list[hit]
[1]"; } else { if($page > 1){ echo " [맨처음] "; } if($page > $page_scale){ $prev_page = $start_page - 1; echo " [이전 $page_scale 개] "; } for ($i=$start_page;$i<=$end_page;$i++){ if ($i==$page){ echo " [$i]"; } else{ echo " [$i]"; } } if($total_pages > $end_page){ $next_page = $end_page+1; echo " [다음 $page_scale 개]"; } if($page < $total_pages){ echo " [맨끝] "; } } ?>

글쓰기