Do this:

$contents = file($file);

foreach($contents as $line_num=>$line_data) {
        $data = explode('|', $line_data);

        
        // now data contains:
        // [0] = aa
        // [1] = bb
        // [2] = cc
        // nd so on

}



Sincerely,

Maxim Maletsky
Founder, Chief Developer

www.PHPBeginner.com   // where PHP Begins



> -----Original Message-----
> From: Rodrigo Peres [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 25, 2002 2:14 AM
> To: PHP
> Subject: [PHP] read text file into mysql
> 
> Hi list,
> 
> I need to read a txt file and insert it lineas a record in mysql.
> My list in the format
> aa|bbbbb bbbb| cccccc |
> fffffff|hhdhdhdh|jsjjsjs
> 
> in other words my separator is "|" and the lines have a return at the
end of
> each one.
> 
> I'm new to PHP, so can anyone help me with and Idea???
> 
> thank's in advance
> 
> Rodrigo
> --
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to