After PHP sub-program finishes, file remains unchanged. Sorry including entitr code so I can show you debug output
Put in debug code. Used to create array and use file_put_contents but am trying to save memory space. code shown is without
<?php
function Reformat($Items,$FN) {
$FM=fopen('txt/$FN.txt','w');
if ($FM===false) {
LOG_IT("open failed");
return;
}
LOG_IT("open OK");
$y = count($Items);
$z=0;
for ($x=0; $x < $y; $x++) {
$I=explode("|",$Items[$x]);
if (count($I) < 4) continue; $z++;
$num=$I[4];$V=$I[5];$I2=$I[2];$I1=$I[1];$I0=$I[0];$I3=$I[3];
$FN2="Comments/C$num";
if (file_exists($FN2)) $C2="<a href='CommentL.php' onclick='Comm(this,$num,$V)'><button>See Comments</button></a>";
else $C2 = "No Comments Yet";
$c=fwrite($FM,"<tr onclick='Switch(\"$I2\")'><td class='HLL'><img src='$I1'></td><td class='HLR'><g>From: $I0</g><br>$I3<br><FL><a href='Comment.html' onclick='Comm(this,$num,$V)'><button>Make a Comment</button></a> $C2</FL></td></tr>\n");
if (!$c) LOG_IT("write failed");
}
LOG_IT("finished OK $z vs $y");
$c=fclose($FM);
LOG_IT("close=$c");
}
supposed to create a file of HTML code, one line for every input line (item in array). Debug output:
open OK
finished OK 84 vs 84
close=1
everything seem OK, but file hasn't changed