Skip navigation links

MySQL Forums :: PHP :: inserting csv data into mysql table using PHP


Advanced Search

inserting csv data into mysql table using PHP
Posted by: John Spencer ()
Date: May 01, 2013 09:26AM

Just looking for some advice on the best way to go about inserting some data(and in the future updating) from a csv file into a mysql db table.

My server doesnt allow the command load data infile so using php just not sure the best approach as my csv file has less columns than the table and different headers than the table.

eg

CSV FILE

'PRODUCT_ID', 'PRICE', 'STOCK', 'DESCRIPTION'

table

products_id, products_price, products_stock, products_status, ect , ect,

Im guessing creating an array from the csv and assigning each column as a $variable then mapping this to the relevant columns in the table then inserting.

there are so many ways to go about the same thing just wanted a bit of advice on which route to take.

thanks for your time.

John.

Options: ReplyQuote


Subject Written By Posted
inserting csv data into mysql table using PHP John Spencer 05/01/2013 09:26AM
Re: inserting csv data into mysql table using PHP Peter Brawley 05/01/2013 09:57AM
Re: inserting csv data into mysql table using PHP John Spencer 05/01/2013 10:14AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.