Re: [php] file open

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




hello,

i'm using the next code:

$fp=fopen("WBSMUTA.CSV","r");
while (!(feof($fp))) {
        $data_file=fgets($fp,4096);
        echo "<br>$data_file<br>";


}


to open a file...

but I want to read it from line 3.. and there is a special function for, but
can't find it back :(

can someone tell me the name of this funcion?

I know I can also use a counter into the while-loop, but I know there is a
better sollution for..

thanks

The while loop is the way to solve it...don't know about an other solution...


$lineNumber = 3;

$txtnm = "WBSMUTA.CSV";
$txtnm = substr($txtnm, 0, -1);
$fd = fopen ($txtnm, "r");
$i = 1;
while (!feof($fd)) {
        // remove first 3 lines from file
        $lines = fgets($fd, 4096);
        if (!($i = $lineNumber)) {
                echo $lines . "<br>";
        }
        $i++;
}
fclose ($fd);




-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux