Re: [PHP] create textfile if not existing?

2002-04-29 Thread David Freeman
On 29 Apr 2002 at 22:49, Hawk wrote: > lets say I have 30 lines of text and I want to store it in a folder called > "txt" with the filename $name.txt and, if $name.txt exists, create a > $name1.txt or similiar? What is it that you are trying to achieve? It sounds like you're trying to store te

RE: [PHP] create textfile if not existing?

2002-04-29 Thread Miguel Cruz
On Mon, 29 Apr 2002, Miguel Cruz wrote: > Might want to do this instead: > > while (is_file("{$filename}{$startnum}.txt") > $startnum++; And perhaps toss in an extra closing paren ) miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsu

RE: [PHP] create textfile if not existing?

2002-04-29 Thread Miguel Cruz
On Mon, 29 Apr 2002, SHEETS,JASON (Non-HP-Boise,ex1) wrote: > // get new filename until the filename does not exist > while (is_file($filename)) { > $filename .= $startnum; > } This will give you file names like file1, file11, file111, etc. Might want to do this instead:

RE: [PHP] create textfile if not existing?

2002-04-29 Thread SHEETS,JASON (Non-HP-Boise,ex1)
doesn't have to loop through used numbers every time but I wrote it as an example for you, use it if you wish. Jason -Original Message- From: Hawk [mailto:[EMAIL PROTECTED]] Sent: Monday, April 29, 2002 2:50 PM To: [EMAIL PROTECTED] Subject: [PHP] create textfile if not existing?

Re: [PHP] create textfile if not existing?

2002-04-29 Thread John Fishworld
This works but the "w" means that it writes over whats already in the file (look at the manual about fopen for more details) $new_file = "txt/whatever.txt"; $fh = fopen($new_file , "w"); // write the changed new file fputs ($fh, $new_code); // now close the file fclose($fh); Regards John > le

Re: [PHP] create textfile if not existing?

2002-04-29 Thread Eric Coleman
Hello, Hawk, You might wanna checkout the "w+" modifier. === At 2002-04-29, 22:49:00 you wrote: === >lets say I have 30 lines of text and I want to store it in a folder called >"txt" with the filename $name.txt and, if $name.txt exists, create a >$name1.txt or similiar? > >Håkan > > > >

Fw: [PHP] create textfile if not existing?

2002-04-29 Thread Richard Emery
Did you even try to develop this application? It's to easy. Do so. If you have problems, then post the code and we'll help you. - Original Message - From: Hawk <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, April 29, 2002 3:49 PM Subject: [PHP]

Re: [PHP] create textfile if not existing?

2002-04-29 Thread Miguel Cruz
On Mon, 29 Apr 2002, Hawk wrote: > lets say I have 30 lines of text and I want to store it in a folder called > "txt" with the filename $name.txt and, if $name.txt exists, create a > $name1.txt or similiar? http://php.net/fopen miguel -- PHP General Mailing List (http://www.php.net/) To unsub

[PHP] create textfile if not existing?

2002-04-29 Thread Hawk
lets say I have 30 lines of text and I want to store it in a folder called "txt" with the filename $name.txt and, if $name.txt exists, create a $name1.txt or similiar? Håkan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php