User Profile

Collapse

Profile Sidebar

Collapse
Justummar
Justummar
Last Activity: Jun 7 '08, 09:44 PM
Joined: Jun 7 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Justummar
    replied to LOAD DATA INFILE only imports 1 row???
    in PHP
    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.
    ...
    See more | Go to post

    Leave a comment:


  • Justummar
    replied to Importing CSV into a mysql DB
    in PHP
    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());
    See more | Go to post

    Leave a comment:


  • Justummar
    replied to LOAD DATA INFILE only imports 1 row???
    in PHP
    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",
    ...
    See more | Go to post
    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:


  • Justummar
    started a topic LOAD DATA INFILE only imports 1 row???
    in PHP

    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

    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());
    But it only imports 1 row at best. If I take out the...
    See more | Go to post

  • 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...
    See more | Go to post
    Last edited by Atli; Jun 7 '08, 07:55 PM. Reason: Removed link to a competing forum.

    Leave a comment:

No activity results to display
Show More
Working...