Strange - fgets/fgetsv ... 8 is not a valid stream resource

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

 



Ive tried to use fget and fgetsv in different formats to parse my file
but keep getting:

Warning: fgetcsv(): 8 is not a valid stream resource in

My code for now looks like this:

 $handle = fopen($thefile, 'r');

 while(($data = fgetcsv($handle, 4096, ',')) !== FALSE)


It fails at the while part, ive even tried adding setlocale, like this
at start of php file:

setlocale(LC_ALL, 'en_US.UTF-8'); (Something found on Google)


But ive also done :

while (($data = fgetcsv($handle, 3000, "|")) !== FALSE)

$ids = fgets($fh, filesize($thefile)+1);


etc.......



I keep on getting the error, it throws out the first line, but then
after that as stated I get the error:

Warning: fgetcsv(): 8 is not a valid stream resource in C:\wa


Any idea what might be wrong?

P.S (ive tried adding file directly in  $handle =
fopen("somefile.txt", 'r');   even.
Also note the input file is a normal text file, created in notepad
saved as .txt, and each field is on its own line, looks like :

163888
157347
9813

no spaces infront or end of line

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


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux