![]() |
|
首页 │ Apache │ Linux│ Java│ MySQL│ 注册│帮助 | |||
相关问题
一个循环错误,读出数据库的内容生成HTML页的时候,生成的第一页(1496.htm)有1篇文章,第二页(1497.htm)有2篇,把第一篇(1496.htm)的文章也写进来了。接下来生成的页面也都有这个问题,可能是变量没有清空,有清空变量的函数吗?
<?
$home="localhost";
$use="root";
$pass="";
$t="sssss";
$conn=mysql_connect($home,$use,$pass) or die(“连接MYSQL错误”);
mysql_select_db($t) or die(“连接MYSQL数据库错误”);
$search="select * from article where id < 1500 and id > 1495";
$news=mysql_query($search);
while($a=mysql_fetch_array($news)){
$mb="textmb.htm";
$op=fopen($mb,r);
while($re=fgets($op,4960)){
if (strstr($re, "")){
$txt=str_replace("","$a[title]",$re);
$re="$txt";
}
elseif(strstr($re, "")){
$txt=str_replace("","$a[text]",$re);
$re="$txt";
}
$frr.="$re\n";
}$oop=fopen("$a[id].htm",w);
$www=fwrite($oop,$frr);
unlink($frr);
}
?>
提问者:seeee 08-15 08:08
答复

