Completed

PHP - Read from CSV and build SQL queries

This project was successfully completed by gracebasilior for $40 USD in a day.

Get free quotes for a project like this
Employer working
Completed by:
Skills Required
Project Budget
$30 - $250 USD
Completed In
1 day
Total Bids
34
Project Description

I have an upload script and I need to make it work with a function that can do the following:

- Read from a CSV file, separator is ","
- The first row in the CSV is the table names, those are the exact same names used in the database in that table so "id" equates to an "id" column in the table same as "city" equates to a "city" column in the table, etc. There are a total of 30 columns in the database table.
- Columns are not in the same order so matching columns regardless of position is needed
- Build an SQL query that UPDATES and INSERTS records from the csv according to the following 2 rules:
* One column is the ID, if the ID is set that means that the record exists and needs to be UPDATEd in the database.
* If the ID field is empty in a row that means that the record doesn't exists and needs to be INSERTED in the database

Just to be clear I have the upload script working and the only thing I need from you is to develop a script that handles the insert and update of the records in the MySQL database as explained above, hopefully in a class/function fashion.

Payment will be 50% when you show me the program working and 50% after I test the code and all possible issues had been resolved.

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online