|
Posted by Rik on 06/19/07 21:32
On Tue, 19 Jun 2007 23:30:42 +0200, Rik <luiheidsgoeroe@hotmail.com> wrote:
> On Tue, 19 Jun 2007 23:03:45 +0200, mantrid <ian.dandav@virgin.net>
> wrote:
>
>> Hello
>> Can anyone point me in the right direction for the way to read a text
>> file a
>> line at a time and separate the fields on that line and use them as
>> data in
>> an INSERT to add a record to a mysql table. Then read the second line in
>> text file and repeat.
>>
>
> Worst case: fgets() & explode()/split(), but depending on the format
> fscanf() or even the great fgetcsv() can be your friends.
Oh, and if it's possible: do not underestimate the power of LOAD DATA
INFILE syntax of mysql itself. No need to fuss around in PHP if MySQL can
do it practically on it's own.
--
Rik Wasmus
[Back to original message]
|