php - Insert csv values into MySQL database using Column Name -


i download data feed supplies property listings real estate websites. converting feed csv files, , have couple of php files insert csv data mysql database. have them working based off of array number (ie '".$mq_out($arr[1])."' , on. problem is, not control feed myself, array numbers change often, when updates made feed. these updates happening frequently, trying avoid having reconfigure arrays every time.

is there way import array data based off of column name in csv file?

here sample of sql insert script , csv file.

$sql = "insert ".$tablename." values (  '',  '',  '".mq_out($arr[9])."',  '".mq_out($arr[5])."',  '".mq_out($arr[7])."' ,  '".mq_out($arr[13])."' ,  '".mq_out($arr[14])."'  ,  '' ,  '".mq_out($arr[u_userlastname])."',  '".mq_out(.$row->u_loginname.)."',  '".mq_out($arr[2])."',  '".mq_out($arr[4])."',  '".mq_out($arr[6])."',  '',  '',  '',  '',  '".mq_out($arr[14])." ".mq_out($arr[15])."',  '',  '',  '')"; 

the csv file here. http://stevenwilsondesigns.com/samplecsv.html


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -