Re: FW: write to file, difficulty inputting data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 31, 2005 5:32 pm, mayo said:
>     if (!$handle = fopen($filename, 'w')) {

This will WIPE OUT the existing file, and write a *NEW* file, from 0,
starting from scratch.

So you'll never have anything but the LAST item.

You could use "a+" to append to the end of the file...

But you *SHOULD* be using a database to avoid concurrency issues.

You're going to have a MUCH better application if you store your data in
the database, and it's EASIER than messing with a file.

Only use a file if a database is absolutely forbidden by outside factors. 
Like badly-design homework assignments.  Or not-very-smart
pointy-haired-bosses.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux