RE: [PHP-DB] How to insert to DB from txt??? Please help
| From: | Nally, Tyler G. | Date: | Fri, 04 Jan 2002 16:38:13 +0000 |
| Subject: | RE: [PHP-DB] How to insert to DB from txt??? Please help | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-15398@lists.php.net to get a copy of this message | ||
How about....
LOAD DATA INFILE 'filename.txt'
INTO TABLE Table
FIELDS TERMINATED BY ',' <---- comma delimited for tabs use '\t'
LINES TERMINATED BY '\n' <---- *nix line terminator, for Dos/Win use
'\r\n'
IGNORE 1 LINES <---- use if the first line of the file has col.
hdrs.
(column1name, column2name, column3name, column4name);
--
__ _ Tyler Nally
/ /__ ____ _(_)___ ____ ____ _________ _ tnally@legion.org
/ / _ \/ __
/ / __ \/ __ \ / __ \/ ___/ __ / 317-860-3016
/ / __/ /_/ / / /_/ / / / // /_/ / / / /_/ / American Legion Website
/_/\___/\__, /_/\____/_/ /_(_)____/_/ \__, / http://www.legion.org
/____/ /____/
> -----Original Message-----
> From: Kelvin [mailto:kelvin_y@decode-ent.com]
> Sent: Friday, January 04, 2002 11:44 AM
> To: php-db@lists.php.net
> Subject: [PHP-DB] How to insert to DB from txt??? Please help
>
>
> Hi everyone,
>
> I have a txt file which is contained the following:
>
> xxxx,aaa,ccc,ddd
> xxxx,aaa,ccc,ddd
> .....etc.
>
> Now, I need to read the data from that file and than
> insert it into the
> table.
>
> ----insert into Table
> ("name","pass","phone","somethingelse")
>
> Could someone help me out here, How to write the code?
> I know how to read from a txt file, but I don't know how
> to separate the
> data determine by ","
>
> Please help, I'll be very appreciate.Thanks
>
> Kelvin.
>
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>