Load Data into MySQL
Posted: Tue Aug 31, 2004 9:04 pm
I am trying to load data from a comma delimited TXT file into a MySQL database (version MySQL 4.0.17-nt). Here is my code:
The page returns this:
feyd | stripped user/pass
Code: Select all
<?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);
?>Any ideas on how to resolve this?Error loading data file.
The used command is not allowed with this MySQL version
feyd | stripped user/pass