The code can run in win98,but run in Linux will appear this wrong prompt :
Warning: fopen("result.htm","w") - Permission denied in /htdocs/star/test/dd.php on line 7
Warning: Supplied argument is not a valid File-Handle resource in /htdocs/star/test/dd.php on line 12
<?
$db=mysql_connect("localhost","root","");
mysql_select_db("test",$db);
$qurey=mysql_query("select * from news where id=1",$db);
$sql=mysql_fetch_array($qurey);
$newfile=fopen("result.htm","w");
$myfile = fopen("model.htm","r");
$test1="<!--insert news -->";
while ($temp=fgets($myfile,4096)){
fputs($newfile,$temp,4096);
if (strstr($temp,$test1)) {
$qurey=mysql_query("select * from news where id=1",$db);
$sql=mysql_fetch_array($qurey);
fputs($newfile,$sql[1],4096);
}
}
fclose($myfile);
fclose($newfile);
?>