Re: Newbie file reading into MySQL
| From: | Kim Kohen | Date: | Sun, 06 Jul 2003 23:44:51 +0000 |
| Subject: | Re: Newbie file reading into MySQL | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-29116@lists.php.net to get a copy of this message | ||
G'day Jason
> Just one question: why are you storing text files containing DATA into a DB?
> Why not just store the data in the DB and do away with the text files?
Thanks for the reply. I can see now my original wording was a bit unclear.
I am, in fact, storing the data only - the text file is just the 'conduit'
to get data from InDesign into PHP. InDesign will generate the text file ->
PHP reads in the data from the file (and than deletes the text file) ->
MySQL stores it -> PHP will report on it.
It's just a matter of how to format the file from InDesign. The two options
would be line by line eg:
Kim
Page 8
Sunday, 6 July 2003 8:08:46 PM
Ad number 1234-t32
Ad placed on page
I'm figuring this way I'd have to use fgets() and go line by line and do 5
separate INSERTs or I could have it as some kind of list eg:
Kim, Page 8, Sunday, 6 July 2003 8:08:46 PM, Ad number 1234-t32, Ad placed
on page
If I do this and get the list into an array, can I have an INSERT statement
along the lines of INSERT INTO test (column1, column2, column3, column4,
column5) VALUES ($myarray) or do I have to parse the array into individual
values before INSERTing?
Logically I'd see one INSERT statement being better than five - I'm just not
sure how to handle the INSERT from an array.
Cheers and thanks
kim