Importing a comma-delimited text file into a mysql database.
| From: | Ray Noel | Date: | Wed, 27 Dec 2000 15:33:20 +0000 |
| Subject: | Importing a comma-delimited text file into a mysql database. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-31964@lists.php.net to get a copy of this message | ||
Hello to all,
Is parsing a comma-delimited, text file that contains numeric and double quoted strings (that occasionally contain commas) easily done in PHP? I've tried it in Perl but the commas in the text fields bring my poor attempt undone.
Is it possible to / how would I use the text file header line (a list of the suppliers data variable names I think) as variable names in PHP? I want to be able to compare the header list with my list of data fields, determine how the data fields are ordered and initialize missing fields before updating my tables. Then I will have a fully automatic system that doesn't depend on the supplier data format remaining unchanged. Of course if the supplier data field names are changed, it's back to the drawing board, but this is unlikely I hope. :-))
TIA
2JRay