[thelist] php writing to a file

Andrew Maynes andrew at uk-webdeveloper.co.uk
Thu May 23 04:39:09 CDT 2002


Steve thank you for that, all very useful.  i totally understand what you have
just said about the databse I use both and I already have the flat (csv) file
schema and the php code working with it hence the solution this way and not to
convert to a database...

Andrew

-----Original Message-----
From: thelist-admin at lists.evolt.org
[mailto:thelist-admin at lists.evolt.org]On Behalf Of Steve Cook
Sent: Thursday, May 23, 2002 10:27
To: 'thelist at lists.evolt.org'
Subject: RE: [thelist] php writing to a file


What you are describing screams for a database solution. If you are not tied
down to using a file-based system, then start looking at a simple database
table to handle the information. Any basic introduction to working with
databases in PHP should give you all the ammunition to code this.

The reason I recommend a database is that it is built from the ground up to
handle this sort of information. Using text files in this way (often
referred to as using a "flat file database") is very possible, but is an
absolute pain in the rear to maintain. I have built similar systems in the
past and each and every time the support of the system was monstrous. In
addition, code to add information, retrieve information and change
information would require a huge amount of code compared to using a
database, which will automate all these jobs and more.

If you are limited to a server that does not give you Database access, then
I would suggest the following Google searches:
http://www.google.com/search?hl=en&lr=&ie=UTF8&oe=UTF8&q=flat+file+php
http://www.google.com/search?hl=en&ie=UTF8&oe=UTF8&q=flat+file+database+php

Here you will find resources to get you on your way. However, if you have
the chance to implement this using databases, then I would say that the time
spent learning the basic principles of database manipulation will be well
spent and will save you from the headaches of supporting a flat-file system.
Here's a good tutorial link:
http://www.blazonry.com/scripting/linksdb/index.php
though you'll find hundreds of others here...
http://www.google.com/search?hl=en&lr=&ie=UTF8&oe=UTF8&q=php+database+tutori
al

Good luck!!

.steve


----------------------------------
 Cookstour - http://cookstour.org
----------------------------------
> -----Original Message-----
> From: Andrew Maynes [mailto:andrew at uk-webdeveloper.co.uk]
> Sent: den 23 maj 2002 10:52
> To: Thelist at Lists. Evolt. Org
> Subject: [thelist] php writing to a file
>
>
> Some while back I asked to write form information into a file
> and was provided
> with this
>
> $string = implode("\t",$_POST);
> $fp = fopen("file.txt","w");
> fwrite($fp,$product);
> fclose($fp);
>
> it seems this can sit anywhere in the form.  It does write to
> a file called
> file.txt
>
> However, this aint a solution.  I need for each different
> user to be able to
> write to a different file and inparticular to be able to
> identify with that file
> later specifically in assocaition with the user who submitted
> the info :) does
> that make sense?
>
--
For unsubscribe and other options, including
the Tip Harvester and archive of thelist go to:
http://lists.evolt.org Workers of the Web, evolt !

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.362 / Virus Database: 199 - Release Date: 5/7/02

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.362 / Virus Database: 199 - Release Date: 5/7/02





More information about the thelist mailing list