> > 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

-- 
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