This is my script...
<?php
include ("config.php");
$fh=fopen($newsidpage, "r");
$newsid=fread($fh, filesize ($newsidpage));
fclose($fh);
if ($repeat == "") {
$repeat=$newsid;
} else {
$repeat=$repeat;
}
$fi=fopen("$hlpg", "w");
fwrite($fi, "");
fclose($fi);
for ($i = 1; $i <= $repeat; $i++) {
$fh=fopen($hlpg, "r");
$hlinfo=fread($fh, filesize ($hlpg));
fclose($fh);
include ("$path$databasedir$newsid.txt");
$fi=fopen($hlpg, "w");
fwrite($fi, "<a href='view.php?nid=$newsid'>$subject</a> - $description<br>$hlinfo");
fclose($fi);
$newsid=$newsid-1;
}
?>
But, as the loop goes round, $hlinfo is always given as "" to the begining of the loop every time, even though the file contains information.
So. Even though the file $hlpg has information inside it written by the previous loop,
$fh=fopen($hlpg, "r");
$hlinfo=fread($fh, filesize ($hlpg));
fclose($fh);
always returns as "" (the file is cleared before the loop)
I just dont understand where im going wrong!