Re: Problem writting to file...
| From: | James Bartlett | Date: | Fri, 06 Jul 2001 18:25:41 +0000 |
| Subject: | Re: Problem writting to file... | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-56544@lists.php.net to get a copy of this message | ||
nope...
The 'new line' tages are printed inside the file but not the values produced by the
counter...
----- Original Message -----
From: Chris Anderson
To: James Bartlett ; php-general@lists.php.net
Sent: Friday, July 06, 2001 7:25 PM
Subject: Re: [PHP] Problem writting to file...
I don't see anything wrong with the code. Does this work:
<?php
$fp = fopen("./data.txt", "w+");
$counter = 0;
for($counter = 0; $counter <6; $counter++)
{
fwrite($fp, $counter . "\n");
}
fclose ($fp);
?>
----- Original Message -----
From: "James Bartlett" <zotud@btinternet.com>
To: <php-general@lists.php.net>
Sent: Friday, July 06, 2001 2:15 PM
Subject: [PHP] Problem writting to file...
Hi,
I'm trying to write data to a file but for some reason it will not store
numbers in the file...Here's the code I'm using...(as an example)
<?php
$fp = fopen("./data.txt", "w+");
$counter = 0;
while ($counter <6)
{
fwrite($fp, $counter . "\n");
$counter = $counter +1;
}
fclose ($fp);
?>
Thanks for any help...
James