We need a small PHP application that will do the following:
1. Two comma-delimited (CSV) text files will be uploaded into FTP folders. The first CSV file defines a database table structure; the 2nd CSV file is data to be imported.
2. Your application must receive 13 parameters: CSV1 FTP username, password, path, filename; CSV2 FTP username, password, path, filename; MySQL DB Host, DB_USERNAME, DB_PASSWORD, DB_NAME, DB_TABLE.
3. This application will first compare the 2 CSV files, we'll call them CSV1 and CSV2. The number of rows in CSV1 must be equal to number of columns in CSV2.
a) If not equal return "ROW_COL_MISMATCH" and end the process.
b) If FTP login fails, return "FTP1_FAIL" or "FTP2_FAIL" as necessary.
c) If DB connection fails, return "DB_NOT_EXIST", "DB_BAD_USER", "DB_BAD_PW" or "DB_OTHER_FAILURE".
d) If CSV1 or CSV2 filenames don't exist, return "CSV1_NOT_EXIST" or CSV2_NOT_EXIST".
3. If compare = true, then create DB_TABLE with the structure specified in CSV1. If DB_TABLE already exists, drop the table first.
4. Import the data from CSV2 into DB_TABLE created in step 3. Rename CSV1 and CSV2 to CSV1_timestamp and CSV2_timestamp.
5. Return "SUCCESS". End process.
We will provide sample files for CSV1 and CSV2. The MySQL database will be on the same host as this PHP application that you will write.
If you have any questions, please post in PMB. It's important that you put up your bid ASAP, but can amend it at any time as long as the project has not been awarded.