RE: [PHP] Problem writting to file...

From: Date: Sat, 07 Jul 2001 02:11:23 +0000
Subject: RE: [PHP] Problem writting to file...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-56595@lists.php.net to get a copy of this message
On 06-Jul-01 James Bartlett wrote: > 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+"); if ($fp) { // always, always ! test a fopen() > $counter = 0; > while ($counter <6) > { > fwrite($fp, $counter . "\n"); // uhmmm... that's binary 0->5 i.e (^A->^E) izzat what you want ? // then why the "\n" ? try fwrite($fp, "$counter\n"); if (! fwrite( )) { // and shurre, you always have enuf disk space ... } > $counter = $counter +1; > } > fclose ($fp); } else { echo "<B>couldn't open file</B>"; } > ?> > > Thanks for any help... > > James -- Don Read dread@texas.net -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it.

« previous php.general (#56595) next »