謝謝各位大大的回覆:
我現在碰到了一個問題
我上下一頁都寫好了
但按下一頁,網址的變數是有在跑啦!!但內容卻沒變,不知是哪裡寫錯
請大大幫我指證一下,謝~~
以下是我的程式
------------------------------------------------------
<?
//計算筆數
$str="select count(*) from album";
$list=mysql_query($str,$link);
$start_num=$read_num*($page_num-1);
list($album_count)=mysql_fetch_row($list);
//下一頁
$pages=intval($album_count/$read_num)+1;
if($page_num>$pages){$page_num=$pages;}
?>
<div align="center">目前共有<font face="Arial" color="red"><? echo $album_count; ?></font>本相簿</div>
<td height="40" width="120" valign="top" align="center">
<p> </p>
<?
//排序預設值
if(empty($sort))$sort="album_date, album_no";
//分頁分析
if(empty($page_num))$page_num="1";
if($page_num<1){$page_num=1;}
$start_num=$read_num * ($page_num-1);
$str="select album_no, album_date, MyFile, album_name, album_describ from album order by $sort limit
$start_num,$read_num";
$list=mysql_query($str,$link);
$i=0;
$j=0;
echo " <table align=center width=800><tr>";
while(list($album_no, $album_date, $MyFile, $album_name, $album_describ)=mysql_fetch_row($list)){
if(strlen($album_name)>12){//將討論主題從0開始擷取40個字元
$album_name=substr($album_name,0,12).".....";
}
if($close_html){ //關閉HTML語法功能之後,進行資料轉換。
$album_name=htmlspecialchars($album_name);
}
if(++$album_num %2>0)
{
$bgcolor="lightyellow";
}
else{
$bgcolor="Snow";
}
echo"<td align=center width=200 height=150 valign=top>\n
<a href='./stu_album_1.php?book=$album_no' >
<img src='/orffmusic/imagesa/$MyFile'
ALT='$MyFile' width='100' height='70' border='0'></a>
<br>
<font color='blue'>$album_name</font>
</td>\n";
$j++;
if ($j % 5 == 0) {echo "</tr>\n";}
}
$count=$j;
if ($count % 5 != 0) {echo "</tr>\n";}
echo "</table>";
?>
<p></p>
<?
$p1=$page_num-1;
$p2=$page_num+1;
if($p1<1){$p1=1;}
echo "<p align=center> <a href=stu_index_album.php?page_num=$p1>上一頁</a>";
// 分頁
$all_page=ceil($album_count/$read_num);
for($i=1;$i<=$all_page;$i++){
echo "<a href='stu_index_album.php?page_num=$i'><font color='blue'> $i|</font></a>";}
echo "<a href=stu_index_album.php?page_num=$p2>下一頁</a></p>";
?>