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

From: Date: Wed, 04 Jun 2008 14:48:42 +0000
Subject: Strange - fgets/fgetsv ... 8 is not a valid stream resource
Groups: php.windows 
Request: Send a blank email to php-windows+get-28923@lists.php.net to get a copy of this message
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

« previous php.windows (#28923) next »