FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Help importing CSV file into MySQL database





Hogwarts
Code:
LOAD DATA LOCAL INFILE 'Table.csv'
INTO TABLE rsCMS
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
(contentID, Title, ContentType, Description, Source, UserIP, DateD, DateM, DateY, DateT, Username, Filepath);


I'm trying to add it using this, but this is not working (It's not on a frihost server, it's a Linux server, I'm trying to add this to the MySQL database in this hosts screwed up version of phpmyadmin)

This is what it throws back at me every time..
Quote:
Inserted rows: -1 (Query took 0.0019 sec)
Code:
SQL query: LOAD DATA LOCAL INFILE '/home/content/T/O/B/TobyW/html/Table.csv' INTO TABLE rsCMS FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n'(
contentID, Title, ContentType, Description, Source, UserIP, DateD, DateM, DateY, DateT, Username, Filepath
);

muggle
You might double check the syntax of the command e.g. http://mysqld.active-venture.com/LOAD_DATA.html particularly the option LOCAL with respect of the following:
Quote:
The LOAD DATA INFILE statement reads rows from a text file into a table at a very high speed. If the LOCAL keyword is specified, it is interpreted with respect to the client end of the connection. When LOCAL is specified, the file is read by the client program on the client host and sent to the server. If LOCAL is not specified, the file must be located on the server host and is read directly by the server. (LOCAL is available in MySQL Version 3.22.6 or later.)

Are you sure that described behaviour reflects your environment i.e. that your file is located on the local file system instead of on the server file system?
Related topics
Mysql database problem
PHPBB MYSQL Database Question.
Problem with MySQL Server Please Help!!
A very good PHP MySQL Tutorial
insert data to mySQL database problem
Delete data from MySQL database problem!!
Need Help integrating php variable into mySQL SELECT query
Need Help with mysql database of DragonflyCMS
Flat file-based, MySQL-based counter
Inserting PHP multidimensional arrays into a mySQL database
mysql database table structure
Changing entries in MySQL database
help getting form info into mysql db
Is there a better way to restore mysql database?
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.