Re: Upload csv file into mysql
| From: | Ignatius Reilly | Date: | Wed, 04 Sep 2002 10:28:07 +0000 |
| Subject: | Re: Upload csv file into mysql | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-21560@lists.php.net to get a copy of this message | ||
You have to create your CSV by escaping the real data commas (eg
"1\,250\,260") when creating your CSV file - \ usually works, but you can
choose sth else if you have "\" actual data characters (usually not
recommended!).
and add
ESCAPED BY "\" to your LOAD statement
HTH
Ignatius
----- Original Message -----
From: "Karel Pøíbramský" <karel@pribramsky.cz>
To: "Ignatius Reilly" <ignatius.reilly@free.fr>; <php-db@lists.php.net>;
"Dr. Indera" <dr.indera@verizon.net>
Sent: Wednesday, September 04, 2002 10:33 AM
Subject: RE: [PHP-DB] Upload csv file into mysql
> Hi this is very helpful to me
>
> what if i have TABLE (id_item, rate1, rate2, rate3, rate4)
>
> and
>
> CSV file like foll
>
> id_item,rate1,rate2
> 1,250,260
> 2,270,280
> 5,290,290
>
> ?
>
> thx kaja
>
>
>
> S prátelským pozdravem
> Karel Príbramský
> AbiaNet, s.r.o.-----------------www.abianet.cz---
>
>
> -----Original Message-----
> From: Ignatius Reilly [mailto:ignatius.reilly@free.fr]
> Sent: Wednesday, September 04, 2002 9:51 AM
> To: php-db@lists.php.net; Dr. Indera
> Subject: Re: [PHP-DB] Upload csv file into mysql
>
>
> Hi Dr,
>
> try:
>
> LOAD DATA INFILE "myfile.csv" INTO TABLE mytable
> FIELDS TERMINATED BY ","
> LINES TERMINATED BY "\r\n" ;
>
> of course, the structure of your CSV file must match exactly that of your
> table.
>
> hth
>
> ----- Original Message -----
> From: "Dr. Indera" <dr.indera@verizon.net>
> To: <php-db@lists.php.net>
> Sent: Wednesday, September 04, 2002 6:20 AM
> Subject: [PHP-DB] Upload csv file into mysql
>
>
> > Hello,
> >
> > Is there a way to upload data in a csv file into a mysql table?
> >
> > Thanks
> > Indera
> >
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>