Picture the scenario, you have access to a gzipped csv datafeed, maybe from awin, maybe from webgains or another network.
You don't know what fields are in it, you want to make a mysql database from this gzipped file.
What if you could just copy the download url into a php file and then run that file which would create your mysql table with field definitions to match the data, and field names which are in the first line of the csv file?
You already have a mysql database on your hosting account and you just want to fill it with lovely data. Then this is for you.
Download Gzipped CSV File and insert contents into MYSql table | Pan Fashion
I've left the forum to farm sheep and cattle.
Thanks for the code, unfortunately I've run into a bit of trouble with it.
There seems to be an issue with creating the table, and on running the script, the following is displayed.
CREATE TABLE IF NOT EXISTStesttable (fields displayed here)Table 'blah.testtable' doesn't exist
Any idea what could be causing this?
I created the table manually, and now it's happy.
This script was really useful, thank you very much
There are currently 1 users browsing this thread. (0 members and 1 guests)