Nevermind.. I discovered that this feature was built into MySQL already!
Here's the cmd I'm using:
LOAD DATA LOCAL INFILE '/home/user/whatever.txt' INTO TABLE Table FIELDS
TERMINATED BY '|' ENCLOSED BY '\"' ESCAPED BY '\\' LINES TERMINATED BY
'\n'
.. for anyone who might have been looking for the same thing.
Thanks!
Ryan
> -----Original Message-----
> From: Ryan Christensen [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, August 07, 2001 3:34 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Rewriting a textfile for import into a db..
>
>
> I have a few thousand entries that have been (until now)
> stored in text-files that I need to get imported into a MySQL
> database for a new system I'm writing that makes use of them.
> So.. the long and short of it, I was wondering if someone
> could help me write a script (or supply me with one.. Perl
> I'm guessing would be easiest) that can turn each line in the
> text file from:
>
> 123|blah|foo|bar|etc
>
> To be formatted like:
>
> INSERT INTO Table VALUES (123,'blah','foo','bar','etc');
>
> Thanks in advance.. any help would be appreciated!
>
> Ryan
>
>
> --
> 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]