国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

來自菜鳥的求助:關(guān)於php生成靜態(tài)列表的循環(huán)
°無恙。
°無恙。 2019-05-22 18:00:06
0
1
1148

請教下各位大佬,php產(chǎn)生靜態(tài)列表,循環(huán)之後資料庫值是正常的,但是產(chǎn)生的html資料一直重複第一次循環(huán)的資料。

for ($i=0; $i < $allpages; $i++){
if ($i==0) 
{ 
$indexpath = "index_0.html"; 
} 
else 
{ 
$indexpath = "index_".$i.".html"; 
} 
$star = $i* $onepage; 
$list =''; 
$sql= "select path,title from article limit $star,$onepage"; 
$result = mysql_query ($sql);  	
while($row=mysql_fetch_assoc($result))
{
	$list.= '<a href="2019/'.$row['path'].'" target="_blank"><li>'.$row['title'].'</li></a><br>'; 
	}
	$content = str_replace("{articletable}",$list,$content);
	if (is_file ($indexpath)) 
	{ 
	@unlink ($indexpath); 
	} 
	$handle = fopen ($indexpath,"w");  
	fwrite ($handle,$content);
	fclose ($handle); 	
}


#
°無恙。
°無恙。

全部回覆(1)
殘留の回憶

你在for循環(huán)裡一直在遍歷資料庫,出來的當然都重複的數(shù)據(jù),把資料庫的while循環(huán)放外面,i放裡面就可以了

最新下載
更多>
網(wǎng)站特效
網(wǎng)站源碼
網(wǎng)站素材
前端模板