RE: [PHP] text importstry this: 

LOAD DATA LOCAL INFILE 'C:\MYDIR\countries.txt' INTO TABLE DBNAME.COUNTRY
LINES TERMINATED BY ',\n' (COUNTRY_NAME)

or if it does not work, simply drop the commas and use the newline character as 
separator ? 

Tomy Wagner
Web Developer
Editus S.A.
  ----- Original Message ----- 
  From: Karl Phillipson 
  To: 'Wagner Tomy' ; [EMAIL PROTECTED] 
  Sent: Tuesday, August 07, 2001 1:16 PM
  Subject: RE: [PHP] text imports


  So if this is the way to do it in SQL, is there a way to get rid of the pipe 
linefeeds using SQL too? 

  If not I s'pose the solution is to run a php 'trim' script, grab the data, perform 
the modifications and then re-insert the data back into the table....

  Bit long winded but if that's the only way? 

  ========================== 
  Karl Phillipson 
  PHP SQL Programmer 

  Saffron Hill Ventures 
  67 Clerkenwell Road 
  London   
  EC1R 5BL 

  Saffron Hill: 0207 693 8300 
  Direct Line: 0207 693 8318 



  -----Original Message----- 
  From: Wagner Tomy [mailto:[EMAIL PROTECTED]] 
  Sent: 07 August 2001 12:06 
  To: Karl Phillipson; [EMAIL PROTECTED] 
  Subject: Re: [PHP] text imports 



  ah k, 

  yes that's the way to do it in SQL ;p 

  Tomy Wagner 
  Web Developer 
  Editus S.A. 

  ----- Original Message ----- 
  From: "Karl Phillipson" <[EMAIL PROTECTED]> 
  To: <[EMAIL PROTECTED]> 
  Sent: Tuesday, August 07, 2001 1:08 PM 
  Subject: RE: [PHP] text imports 



  > Yup, thanks Wagner. 
  > 
  > I can do this within PHP itself using trim or chop, I was hoping for a 
  > snippet of SQL code that would do it from the command line. 
  > 
  > This is what  have done: 
  > 
  > LOAD DATA LOCAL INFILE 'C:\MYDIR\countries.txt' INTO TABLE DBNAME.COUNTRY 
  > LINES TERMINATED BY ',' (COUNTRY_NAME) 
  > 
  > ========================== 
  > Karl Phillipson 
  > PHP SQL Programmer 
  > 
  > Saffron Hill Ventures 
  > 67 Clerkenwell Road 
  > London 
  > EC1R 5BL 
  > 
  > Saffron Hill: 0207 693 8300 
  > Direct Line: 0207 693 8318 
  > 
  > 
  > -----Original Message----- 
  > From: Wagner Tomy [mailto:[EMAIL PROTECTED]] 
  > Sent: 07 August 2001 12:00 
  > To: Karl Phillipson; 'Alexander Wagner'; MindHunter; 
  > [EMAIL PROTECTED] 
  > Subject: Re: [PHP] text imports 
  > 
  > 
  > http://www.php.net/manual/en/function.chop.php 
  > 
  > Returns the argument string without trailing whitespace, including 
  newlines 
  > 
  > Wagner Tomy 
  > Web Developer 
  > Editus S.A. 
  > ----- Original Message ----- 
  > From: "Karl Phillipson" <[EMAIL PROTECTED]> 
  > To: "'Alexander Wagner'" <[EMAIL PROTECTED]>; "MindHunter" 
  > <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> 
  > Sent: Tuesday, August 07, 2001 12:53 PM 
  > Subject: [PHP] text imports 
  > 
  > 
  > > Hi, 
  > > 
  > > I have been given a (notepad generated) text file which contains a list 
  of 
  > > countries in a format such as: 
  > > 
  > > United Kingdom, 
  > > United States, 
  > > Blah, 
  > > Blah, 
  > > Blah, 
  > > 
  > >  I have imported the data into a countries table in a mySQL database 
  using 
  > > the excellent 'mysqlfront' prog. No probs on the import itself except 
  for 
  > > some pesky pipes that I believe to be carriage returns. 
  > > 
  > > Anyone know a way I can strip these out so I have nice clean data. 
  > > 
  > > Ta in adavance. 
  > > 
  > > Karl 
  > > 
  > > 
  > > 
  > > Saffron Hill Ventures 
  > > 67 Clerkenwell Road 
  > > London 
  > > EC1R 5BL 
  > > 
  > > Saffron Hill: 0207 693 8300 
  > > 
  > 
  > 
  > -- 
  > PHP General Mailing List (http://www.php.net/) 
  > To unsubscribe, e-mail: [EMAIL PROTECTED] 
  > For additional commands, e-mail: [EMAIL PROTECTED] 
  > To contact the list administrators, e-mail: [EMAIL PROTECTED] 
  > 



  -- 
  PHP General Mailing List (http://www.php.net/) 
  To unsubscribe, e-mail: [EMAIL PROTECTED] 
  For additional commands, e-mail: [EMAIL PROTECTED] 
  To contact the list administrators, e-mail: [EMAIL PROTECTED] 

Reply via email to