edziffel;10985894 wrote:When I tried to upload it to a date column, it came back all zeros. Probably has a lot to do with being clueless on how to set up the data field in the database prior to upload. What am I dong wrong?
MySQL DATETIME columns are in the format 'YYYY-MM-DD HH:MM:SS', so unless the data is in that exact format, you will need to convert it rather than just throwing it at the DATETIME field and expecting MySQL to understand what type of data you've given it.
One way to convert the date inside the SQL query itself would be to use MySQL's STR_TO_DATE() function.
edziffel;10985894 wrote:Also could you briefly describe how you would go about cleaning up the data from the csv before insert?
I wouldn't (at least, not as far as the date values are concerned - MySQL is perfectly capable of handling the conversion itself).
edziffel;10985894 wrote:Also not clear on how to get the corrected data back into the csv in order to then upload.
Upload to where?
Also, since we're talking about a CSV file here, do you need to do any sort of extra processing on the data, or are you simply importing it into a MySQL database? If the latter is the case, then note that you don't need to use PHP to process the CSV file at all - just use a LOAD DATA INFILE query instead.