Rate: | Price: Free | Publisher: Office Site | Demo: | Views: 1657
PHP Script Codes > Simple csv to MySQL tool
This code will take a csv file and create or, insert or update, the data into a MySQL database. It assumes the first line contains the field names and uses that to build the SQL query for the following data lines.
There's a download button for pulling in the csv file.
A CREATE button will create a simple database using VARCHAR() with all the fields length set to the longest length of any field.
The INSERT button will insert the data.
The BUILD FIELD LIST button does just that so you can select the field if you're doing an UPDATE operation. Index fields in the database are shown.
There are few checks to ensure that an operation will succeed. INSERT into a table that doesn't exist for example will error etc.
The code is heavily commented and should be ewasy to follow/amend.