RE: [PHP] Loading CSV data into MySQL
| From: | John W. Holmes | Date: | Sun, 02 Feb 2003 15:10:13 +0000 |
| Subject: | RE: [PHP] Loading CSV data into MySQL | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-134000@lists.php.net to get a copy of this message | ||
> > Then use an ORDER BY in your query. If you're relying on the
database to
> > spit out rows in the order they went in, then you're wrong.
>
> Hey man thanks for pointing that out... !!!! I know it's wrong, I
didn't
> design it but it's what I have to work with and I'm not being paid to
> fix it. And quite frankly clients being as ignorant as they tend to be
> at times just know that its worked fine for years and don't want to
hear
> that they have to spend money fixing something that as far as they can
> tell has always worked fine. That being said, in this instance, due to
> poor design, I need this stuff to be in there in a particular order.
If
> that's not possible then I'll just have to suck it up and rebuild this
> thing for free but if I can find a way around that for the time being
> then....
Then don't use LOAD DATA INFILE if it's not working for you. Write a PHP
script to read each line of the file and insert it. Yes, it'll be a
little slower, but then you could also add an auto_increment or
timestamp field that'll keep track of how things were inserted...
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/