Basic Question about closing a file
| From: | Arthur | Date: | Thu, 12 Sep 2002 19:41:19 +0000 |
| Subject: | Basic Question about closing a file | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-15781@lists.php.net to get a copy of this message | ||
The file in the code below is not closing successfully. Variable $FC = 1.
Can someone tell me what is going on?
Thanks
Arthur
$OpenCSV = fopen ($FileCSV, "w");
if ($OpenCSV = fopen ($FileCSV, "w")) {
print ("The Sales CSV file was opened successfully<BR>\n");
} else {
print ("The query could not be executed!<BR>\n");
}
while { // stuff is happening w/ database and calculations here
fwrite ($OpenCSV, "$Orders_id,$Products_id, etc ...\n");}
$FC = fclose ($OpenCSV);
if (fclose ($OpenCSV)) {
print ("The Sales CSV file was Created successfully$FC<BR>\n");
} else {
print ("The Sales CSV could not be executed!$FC<BR>\n");
}
--
-----------------------------------------------------
Click here for Free Video!!
http://www.gohip.com/free_video/