Forum Moderators: coopster
For "Fields terminated by" I put: \t - which I'm guessing is a tab.
"Fields enclosed by" I left blank
"Fields escaped by" I left blank
"Lines terminated by" I put : \r\n
and got the following error:
Error
SQL-query :
LOAD DATA LOCAL INFILE '/tmp/phpoQ2G7Q' INTO TABLE `my_table` FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\r\n'
MySQL said:
The used command is not allowed with this MySQL version
Am I doing something wrong with the escaped by or terminated fields? Or is it something else entirely?
So what are my options? We don't have shell access either because the server was recently broke into that way.
The file is a data feed from a merchant. This is my first time to use one and bringing it into MySQL seems like the best way to make use of it. What does everyone else do?
Am I understanding this correct:
mysqlimport provides a command-line interface to the LOAD DATA INFILE SQL statement.
It sounds to me that "mysqlimport" can only be used through a command line?
Another possible problem could be that my host has version 2.2.4 of phpMyAdmin installed. Looking through the phpMyAdmin site I see that 2.4 was released and they list one of the fixes for it as "handling of "LOCAL" in recent MySQL versions for LOAD DATA INFILE". I don't really understand what that means however.
I sent an email to my host, maybe he can help.
If the command, 'load data' is disabled, I wouldn't think you could use it in a php script either. I asked him this, but haven't heard back yet.
In general, how do you read and import data through a script? With load data? mysqlimport? Anyone know?
2. use fopen [php.net] to open a file file pointer to the csv file.
3. use fgetcsv [php.net] to read it line by line in the script.
4. use mysql functions [php.net] to insert your values into your table.