RE: [PHP-DB] external file content

From: Date: Sun, 18 May 2003 20:40:58 +0000
Subject: RE: [PHP-DB] external file content
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-27867@lists.php.net to get a copy of this message
> this may seem like a simple thing to do but i'm just a newbie to PHP. > here goes. > > i've got and external life "/my/path/report.txt" > the content of this file is arranged as > > id1|fname|lname|address|country|post_code > id2|fname|lname|address|country|post_code > id3|fname|lname|address|country|post_code > id4|fname|lname|address|country|post_code > id5|fname|lname|address|country|post_code > id6|fname|lname|address|country|post_code > id7|fname|lname|address|country|post_code > > i would like to be able to read through the file and extract each line to > be places in a table. Read the file with the file() function to get each line as an element in an array. Loop through the array and explode each element by the | character. You've then got each part of the file in it's own variable. www.php.net/file www.php.net/explode ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/

« previous php.db (#27867) next »