Re: load data infile problem
| From: | Nicole Amashta | Date: | Fri, 25 Jan 2002 19:05:17 +0000 |
| Subject: | Re: load data infile problem | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-11647@lists.php.net to get a copy of this message | ||
Assuming the file is in parsable format, such as csv, you can just read
through the file, form insert statements, and insert the data this way.
Example:
you file: cats.txt
===============================
"name","color","gender","age"
"Sly","black and white", "male", 2
"Tiger","orange","male",2
"Chloe","white","female",1
===============================
you can read through that file, parse it row by row, field by field, and
create insert statements like so and insert the data on the fly ...
nicole
www.aeontrek.com
"Rop30999" <rop30999@mail.telepac.pt> wrote in message
news:20020119213416.88800.qmail@pb1.pair.com...
> I have a called file cats.txt which count data that were solitary of a DB
> Access.
> I need to export these data for a table 'cats' inside of a DB done in
MySql.
>
> In MySql I can execute this procedure in the following way:
>
> Load data local infile "gatos.txt"
> into table gatos
> fields
> terminated by ','
> enclosed by '"'
> (Id, Nome, Raça);
>
> I need to know how I can accomplish this same operation but using PHP
>
> Thank you
>
> Paulo
>
>