if(is_null($_POST['PageNum'])){
$PageNum = $_GET['PageNum'];
}else{
$PageNum = $_POST['$PageNum'];
}
mysql_connect('localhost', 'seawoun', 'seawoun@web');
//mysql_connect('localhost');
//上面變數依序是位置、登入資料庫名稱、登入資料庫密碼
mysql_query("set names utf8");
mysql_select_db('seawoun') or die ("無法選擇資料庫".mysql_error());
$sql="SELECT sn,title,link,time FROM announce ORDER by time DESC";
$result=mysql_query($sql);
$num_rows=mysql_num_rows($result);
?>

if($num_rows==0){
?>
目 前 沒 有 資 料 ! |
echo "
";
}
elseif($num_rows>0)
{
if($num_rows%15==0){
$PageMax = ($num_rows - ($num_rows%15))/15;
}else{
$PageMax = ($num_rows - ($num_rows%15))/15 + 1;
}
if(is_null($PageNum)){
$PageNum = 1;
}
$num = 1;
for($i=0;$i<$num_rows;$i++)
{
$record = mysql_fetch_array($result);
$hotpic = strtotime("now")-strtotime($record['time']);
if(($i+1>=($PageNum-1)*15+1)&&($i+1<=$PageNum*15)){
?>
if((is_null($record['link']))||($record['link']==""))
{
echo $record['title'];
}
else
{
?>
echo $record['title']?>
}
if($hotpic < 1209600){
?>
}
?>
|
echo substr($record['time'],0,10)?> |
$num++;
}
}
?>
if($PageNum==1){
echo "第一頁 上一頁 ";
}else{
?>
第一頁 上一頁
}
if($PageNum==$PageMax){
echo "下一頁 最終頁";
}else{
?>
下一頁 最終頁
}
?>
|
}
?>
Copyright ©國立中山大學西灣學人版權所有
Design by MBA99 Steven Chen
高雄市鼓山區 804 蓮海路 70 號 | 70. Lianhai Rd., Kaohsiung, 804 Taiwan.