You are here: Re: How read ONLY last row ASCII fil.e « PHP Language « IT news, forums, messages
Re: How read ONLY last row ASCII fil.e

Posted by KoopaJah on 02/08/07 16:07

Ilkka Maatta a écrit :

Hello !

> PHP code .....
>
> <?
> //Open file.
> $file=fopen("file.txt","r");
> //read file so long when it isn't end.
> while (!feof($file))
> {
> //read and print row + LF.
> $rivi=fgets($file,1024);
> print "$row<BR>";
> }
> //Close file.
> fclose($file);
> ?>
>
> ....is read file(ascii) and print it display.

this seems strange as you retrieve the line in $rivi and print $row. You
should print $rivi at least

>
> How i can read and print only last row - don't all row?

just never print the line in the while loop. Like this you just update
the line in $rivi until you reach the end of the file. Then (after the
while loop) you print $rivi which contains the last line read.


Sincerely,

Remi J.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация