loading csv file into mysql

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • D. Alvarado

    loading csv file into mysql

    Hello,
    I have discovered the beauties of the 'LOAD DATA INFILE' mysql
    command. However, I was wondering if someone could help me manipulate
    my command to accommodate for the 3 potential types of line endings --
    '\n', '\r', and '\n\r' (or whatever is the default line ending on
    Windows systems).

    What I have so far is ...

    $query = "LOAD DATA INFILE \"$src_file_pat h\" REPLACE INTO
    TABLE HB_USPS_ZIP_COD ES FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED
    BY '\"' LINES TERMINATED BY '\n'";
    $dbh = mysql_query($qu ery);

    Thanks for any help, - Dave
Working...