With 1.7 million freelancers, we'll match you with the perfect talent.
The client has made the following changes to the job.
Client prefers freelancers from:
You are still able to submit a proposal for this job.
The client prefers freelancers from
a different location.
I have 1200 CSV files in a folder.
Each file has between 1000 to 5000 rows of data.
The first row in each file is the header.
While some of the header items are common across all files, many are not. And even when they are common, they do not necessarily appear in the same order.
II. What I want:
[I will create a MySQL database with one table named 'tbl_csv' in it.]
I want two PHP scripts:
(a) A configuration script, where I should be able to add:
- The database connection string
- Name of the db table
- Path to the directory where the CSV files are stored
- Any other info necessary to run the main script
(b) The main script, which should do the following:
1. Scan through one CSV file at a time
- Create a new column in 'tbl_csv' for each new header item in the CSV files (csv header name = db column name)
2. Scan through the CSV files again, one file at a time
- Insert the data under each header into the appropriate column in the database
Sign in or Register to see more