Ok, after browsing through the site I’ve already discover a partial solution to my question but I figure I will post it in it’s entirety and see if you geniuses can shed some light. I need to Write a program that downloads a text file, parses the file, stores it in a mysql database and then outputs it to a page.
I understand I have to write a cron to download the text file (although I do not necessarily know how) and then I have to parse. The text file may be comma space or tab delimited, I’m not sure. The end of the line is the end of the entry. Once text file is parsed I want to store each of the fields in a corresponding my_sql database. This needs to happen once every six hours or so . . . any help would be great . . . . thanks
Parsing Delimited Test Files and Placing in My_SQL DB
Moderator: General Moderators
-
isotope328
- Forum Newbie
- Posts: 2
- Joined: Thu Dec 25, 2003 8:03 pm
Skip the PHP, do it in MySQL. That's what LOAD DATA INFILE is for. As far as scheduling it goes, you can either have PHP do the query or you can just pipe the query straight to MySQL and forego the PHP entirely.
-
isotope328
- Forum Newbie
- Posts: 2
- Joined: Thu Dec 25, 2003 8:03 pm
Moving Forward
hanks a lot, your information was very helpful I was able to use the function to successfully get the text files into the database. Furthermore I found that phpMyAdmin makes this process very simple. My problem now is, automation the file exists on an ftp server as a zip file. So far I have only been able to download the file locally, unzip and upload to the database using LOAD DATA INFILE. You mentioned Piping the query into SQL . . . what does that entail I noticed a section under the definition of the LOAD DATA INFILE description talking about piping and zip files but it was over my head. Mt host is running Linux, PhpMyAdmin, and it supports Linux crons (something I know nothing about) if you could elaborate a little on how I may move forward, it would be much appreciated
Thanks!
Thanks!