Re: newbie: extracting lines from a text file w/ php

From: Date: Fri, 28 Sep 2001 01:13:48 +0000
Subject: Re: newbie: extracting lines from a text file w/ php
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-69081@lists.php.net to get a copy of this message
On Fri, 28 Sep 2001 10:03, sc wrote: > Hi; > > I am new to php and i need to extract specific lines of data from a > plain text file and insert it into a sql db.... Can anyone give me some > details on howto do this? or an example to read the specific line that > i need? > > Thanks. > > > -sc If the source file isn't _too_ huge, you could use file() to read it into an array, then loop through the array, testing each element to see if it meets yor criteria. If so, just write the array element into your database. If the file is sizeable, you might wnt to fopen() the file, then use fgets() to read in lline by line, test the line and action accordingly. -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA "This is what I have learned off by heart" Tom wrote.

« previous php.general (#69081) next »