$db = mysql_connect("127.0.0.1","root","********") or die("無法連接主機");
$re = mysql_select_db("t" ,$db)or die("無法開啟資料庫");
$sql = "從新聞中選擇*";
$res = mysql_query($sql);
$row = mysql_num_rows($res );
$pagesize = 2; //分頁
$pagesize){
$ pages = intval($row/$pagesize)+1;
}else{
$pages = intval($row/$pagesize);
}
for($i=1;$ $page_turn="";
if($i==1){
第一| 前面";
}其他{
$indexpath="index_".$i.".html";
個 |
前面";
}
if($i==$pages){
$page_turn.=' | 後面| 最後的';
}else{
後面 |
最後";
}
$search." 1)*$pagesize .", $pagesize";
$結果= mysql_query($search);
> $list= "";
while($j $doc = mysql ;
$title = $doc ['1'];
$path = $doc['3'];
/a>
";
$j+=1;
}
list.html","r");
$str = fread($fp,filesize("html/list.html"));
$str $str);
fclose($fp);
$handle = fopen($path."/".$indexpath,"w");
fwrite($indexpath,"w");
fwrite($handhandle,$strrite($ > fclose($handle);
}
copy($path >
以上就介紹了產生html使用PHP產生html分頁清單的程式碼,包含了產生html方面的內容,希望對PHP教學有興趣的朋友有幫助。