<?php
## Connect to a local database server (or die) ##
$dbH = mysql_connect('localhost', '********', '*********') or die('Could not connect to MySQL server.<br>' . mysql_error());
## Select the database to insert to ##
mysql_select_db('econtrol_canaanloanscom') or die('Could not select database<br>' . mysql_error());
## CSV file to read in ##
$CSVFile = 'data.txt';
mysql_query('LOAD DATA LOCAL INFILE "data.txt" INTO TABLE var_zipcodes FIELDS TERMINATED BY "," LINES TERMINATED BY "\\r\\n";') or die('Error loading data file.<br>' . mysql_error());
## Close database connection when finished ##
mysql_close($dbH);
?>
The page returns this:
Error loading data file.
The used command is not allowed with this MySQL version
As an altenative to 'Load Data .." you could always read the file contents into an array. Then loop thru the array and "explode" each line. At which point you could insert the 'fields'/data into the table.