= $totalcount) $article_end = $totalcount; $final_page = intval(($totalcount+$pagelog-1) / $pagelog); if ($page>=$final_page) { $next_page = $final_page; } else { $next_page = $page+1; } if ($article_start==$article_end && $page > 1) { $page--; $article_start -= $pagelog; } if (!$final_page) $final_page = 1; $sql = " select no, category1, category2, title, body, user_id, image_file_path1, image_file_path2, regdate, is_public, is_sync from t3_".$dbid." where 1 $add_query order by regdate desc limit $article_start, ".intval($article_end-$article_start); $result = @mysql_query($sql); $flag = false; while(list( $no, $category1, $category2, $title, $body, $user_id, $image_file_path1, $image_file_path2, $regdate, $is_public, $is_sync ) = @mysql_fetch_array($result)) { if ($flag) { ?>