game2002 Posted June 24, 2007 Share Posted June 24, 2007 I have an array that I am trying to write to a file. The array is fine when I print it. But for some reason, the file content doesn't change. And I don't get any error. here is the code. Thanks for helping. $zonefile = 'setAdzoneFlag.txt'; print " filename is $zonefile<br>"; if (is_writable($zonefile)) { $handle = fopen($zonefile, 'w+') or die("cannot open file $zonefile");; $fileline = "The zones\r\n"; if (fwrite($handle, $fileline) === FALSE){ print "Error: Unable to write to file: $zonefile <br>"; die('<br><br>cannot write'); } print " fileline1 is $fileline<br>"; for ($i = 0; $i < count($groupeZones); $i++) { $fileline = key($groupeZones).",".current($groupeZones)."\r\n"; print " fileline is $fileline<br>"; //data is good fwrite($handle, $fileline); next($groupeZones); } fclose($handle); } else echo "The file $filename is not writable"; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.