I should tell you that the "text file" is an htm that i have to print 
withou the header "<HTML><TITLE>...." and footer "</BODY></HTML>"

:PP

Rafael

>I know, it was already answered before me (you),
>
>I just though that an SQL database is a good advice for these who are trying
>to do this kind of jobs.
>It is obvious that the reason to use this function is to manage a stored
>data in files.
>then why not a database, if possible?
>
>
>Sincerely,
>
>  Maxim Maletsky
>  Founder, Chief Developer
>  PHPBeginner.com (Where PHP Begins)
>  [EMAIL PROTECTED]
>  www.phpbeginner.com
>
>
>
>-----Original Message-----
>From: Jason Murray [mailto:[EMAIL PROTECTED]]
>Sent: Wednesday, April 25, 2001 4:52 PM
>To: Maxim Maletsky; 'Rafael Faria'; [EMAIL PROTECTED]
>Subject: RE: [PHP] Lines
>
>
> > > it's my first post on this list, and my doubt is...
> > >
> > > how can i take a file.txt and
> > >
> > > 1 - know how many lines i have in this text
> > > 2 - print line 5 until 10
>
> > Is there any chance for you to use a database?
> > these thing would become MUCH, MUCH easier.
>
>Actually, this is really easy without using a database.
>
>1. <?
>       $filename = "/path/to/file";
>       $filedata = file($filename);
>       $linesinfile = count($filedata);
>    ?>
>
>2. <?
>       $startline = 5;
>       $stopline = 10;
>
>       for ($i = $startline; $i < $stopline; $i++ )
>       {
>         echo $filedata[$i-1];
>       }
>    ?>
>
>(Use $i-1 because the first line is actually "0").
>
>Jason

---

[ r a f a e l   f a r i a] _____________________
[EMAIL PROTECTED]
WebMaster Universo Online - http://www.uol.com.br
Phone # +55 11 3038-8665


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to