Thank you for you reply, most appreciated.
No I tried all different combination of \\n\\r and \n and so on
But it turns out, the reason it was importing only 1 row was that the first field or should i say the primary key field constraint was preventing it from adding more. I removed the primary key of that field as it was a single table with no relationships to any other tables. Its working now with just "\n" also.
...
User Profile
Collapse
-
or you could use
Code:$sql = "LOAD DATA LOCAL INFILE 'xfile.txt' INTO TABLE `lettings` FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\\n' IGNORE 1 LINES;"; mysql_query($sql) or die('Error loading data file.<br>' . mysql_error());Leave a comment:
-
Oh and this is what xfile.txt looks like
...Code:"BranchID", "PropertyID", "PropertyName", "Street", "DisplayStreet", "Postcode", "PricePrefix", "Price", "Bedrooms", "Receptions", "Bathrooms", "ParkingSpaces", "Numeric5", "Numeric6", "Numeric7", "Numeric8", "Numeric9", "AREA",
Last edited by Atli; Jun 7 '08, 07:37 PM. Reason: Added [code] tags and some spaces so it doesn't streach the window.Leave a comment:
-
LOAD DATA INFILE only imports 1 row???
I am using the following
This is on a server with mysql version : 3.23.56 and PHP version: 4.3.10
But it only imports 1 row at best. If I take out the...Code:$sql = "LOAD DATA LOCAL INFILE 'xfile.txt' INTO TABLE `lettings` FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\\n' IGNORE 1 LINES;"; mysql_query($sql) or die('Error loading data file.<br>' . mysql_error()); -
Removed link to a competing forum.
Try this, I think this is what you are looking for.
<link removed>
http://dev.mysql.com/doc/refman/5.0/en/load-data.html
http://russell.dyerhouse.com/cgi-bin...?article_id=31...Leave a comment:
No activity results to display
Show More
Leave a comment: