Re: [PHP] fgetcsv doesn't return an array?

2012-03-18 Thread Lester Caine
Tamara Temple wrote: On Thu, 15 Mar 2012 12:09:53 -0500, Jay Blanchard sent: I thought that fgetcsv returned an array. I can work with it like an array but I get the following warning when using it |Warning: implode(): Invalid arguments passed on line 155 154$csvCurrentLine = fgetcsv($c

Re: [PHP] fgetcsv doesn't return an array?

2012-03-18 Thread Tamara Temple
On Thu, 15 Mar 2012 12:09:53 -0500, Jay Blanchard sent: I thought that fgetcsv returned an array. I can work with it like an array but I get the following warning when using it |Warning: implode(): Invalid arguments passed on line 155 154 $csvCurrentLine = fgetcsv($csvFile, 4096, ',');

Re: [PHP] fgetcsv doesn't return an array?

2012-03-16 Thread Jay Blanchard
[snip] Not sure why, but ok. Thanks everyone! An empty line would lead to $csvCurrentLine == array() which as a boolean would be false but would not necessarily mean EOF. By using === to check the value the expression will only evaluate to false at EOF or an error. -Stuart [/snip] Makes per

Re: [PHP] fgetcsv doesn't return an array?

2012-03-15 Thread Stuart Dallas
On 15 Mar 2012, at 20:26, Jay Blanchard wrote: > [snip] >> Please, don't do that. Use this instead: >> while (($csvCurrentLine = fgetcsv($csvFile, 4096, ',')) !== FALSE) { >> } >> [/snip] > > Not sure why, but ok. Thanks everyone! An empty line would lead to $csvCurrentLine == array() which as a

Re: [PHP] fgetcsv doesn't return an array?

2012-03-15 Thread Jay Blanchard
[snip] > Please, don't do that. Use this instead: > while (($csvCurrentLine = fgetcsv($csvFile, 4096, ',')) !== FALSE) { > } > [/snip] Not sure why, but ok. Thanks everyone! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] fgetcsv doesn't return an array?

2012-03-15 Thread Matijn Woudt
On Thu, Mar 15, 2012 at 6:40 PM, Andrew Ballard wrote: > On Thu, Mar 15, 2012 at 1:29 PM, Jay Blanchard > wrote: >> On 3/15/2012 12:23 PM, Matijn Woudt wrote: >>> >>> On Thu, Mar 15, 2012 at 6:09 PM, Jay Blanchard >>>  wrote: I thought that fgetcsv returned an array. I can work with it

Re: [PHP] fgetcsv doesn't return an array?

2012-03-15 Thread Lester Caine
Jay Blanchard wrote: 154 $csvCurrentLine = fgetcsv($csvFile, 4096, ','); 155 $currentLine = implode(",", $csvCurrentLine); I am using it in a loop. End Of File is an error? You certainly need to break out on $csvCurrentLine = false which indicates end of file at least. My own 'loo

Re: [PHP] fgetcsv doesn't return an array?

2012-03-15 Thread Andrew Ballard
On Thu, Mar 15, 2012 at 1:29 PM, Jay Blanchard wrote: > On 3/15/2012 12:23 PM, Matijn Woudt wrote: >> >> On Thu, Mar 15, 2012 at 6:09 PM, Jay Blanchard >>  wrote: >>> >>> I thought that fgetcsv returned an array. I can work with it like an >>> array >>> but I get the following warning when using

Re: [PHP] fgetcsv doesn't return an array?

2012-03-15 Thread Jim Lucas
On 03/15/2012 10:09 AM, Jay Blanchard wrote: I thought that fgetcsv returned an array. I can work with it like an array but I get the following warning when using it |Warning: implode(): Invalid arguments passed on line 155 154 $csvCurrentLine = fgetcsv($csvFile, 4096, ','); 155 $currentLine =

Re: [PHP] fgetcsv doesn't return an array?

2012-03-15 Thread Jay Blanchard
On 3/15/2012 12:23 PM, Matijn Woudt wrote: On Thu, Mar 15, 2012 at 6:09 PM, Jay Blanchard wrote: I thought that fgetcsv returned an array. I can work with it like an array but I get the following warning when using it |Warning: implode(): Invalid arguments passed on line 155 154 $csvCur

Re: [PHP] fgetcsv doesn't return an array?

2012-03-15 Thread Matijn Woudt
On Thu, Mar 15, 2012 at 6:09 PM, Jay Blanchard wrote: > I thought that fgetcsv returned an array. I can work with it like an array > but I get the following warning when using it > > |Warning:  implode(): Invalid arguments passed on line 155 > > 154     $csvCurrentLine = fgetcsv($csvFile, 4096, ',

[PHP] fgetcsv doesn't return an array?

2012-03-15 Thread Jay Blanchard
I thought that fgetcsv returned an array. I can work with it like an array but I get the following warning when using it |Warning: implode(): Invalid arguments passed on line 155 154 $csvCurrentLine = fgetcsv($csvFile, 4096, ','); 155 $currentLine = implode(",", $csvCurrentLine); | Ev

Re: [PHP] fgetcsv

2008-01-09 Thread Danny Brow
You are so right, takes all of 0.122 s to process the whole file with the fgetcsv inside the while loop Guess I need to look up why this was the problem. Thanks everyone! On Wed, 2008-01-09 at 20:59 -0600, Richard Lynch wrote: > 6500 rows is chump-change. > > You probably don't have the fge

RE: [PHP] fgetcsv

2008-01-09 Thread Danny Brow
Um, I've read the manual. On Wed, 2008-01-09 at 20:11 -0500, Bastien Koert wrote: > http://ca.php.net/manual/en/function.fgetcsv.php > _ > Discover new ways to stay in touch with Windows Live! Visit the City @ Live > today! > http:/

Re: [PHP] fgetcsv

2008-01-09 Thread Richard Lynch
6500 rows is chump-change. You probably don't have the fgetcsv inside the while loop to get past the first row... :-) On Wed, January 9, 2008 6:09 pm, Danny Brow wrote: > I need to compare the first field of each row. But this idea is shot > to > hell, i've been running one of the examples on the

Re: [PHP] fgetcsv

2008-01-09 Thread Richard Lynch
On Wed, January 9, 2008 4:35 pm, Danny Brow wrote: > I'm trying to compare a value to the first field in a csv fILE > (example > of the data below). Using while takes too long and I can't figure out > how to compare just one row at a time. I've tried some variations of > the > following. > > > //Co

RE: [PHP] fgetcsv

2008-01-09 Thread Bastien Koert
http://ca.php.net/manual/en/function.fgetcsv.php _ Discover new ways to stay in touch with Windows Live! Visit the City @ Live today! http://getyourliveid.ca/?icid=LIVEIDENCA006 -- PHP General Mailing List (http://www.php.net/) To un

Re: [PHP] fgetcsv

2008-01-09 Thread Jim Lucas
Danny Brow wrote: I need to compare the first field of each row. But this idea is shot to hell, i've been running one of the examples on the file and it's been about an hour+ already... 6500 records have to be checked... I think MySQL is calling my name right now. Thanks, Dan On Thu, 2008-01-1

Re: [PHP] fgetcsv

2008-01-09 Thread Danny Brow
I need to compare the first field of each row. But this idea is shot to hell, i've been running one of the examples on the file and it's been about an hour+ already... 6500 records have to be checked... I think MySQL is calling my name right now. Thanks, Dan On Thu, 2008-01-10 at 09:59 +1100, Ch

Re: [PHP] fgetcsv

2008-01-09 Thread Chris
Danny Brow wrote: Hi Everyone, I'm trying to compare a value to the first field in a csv fILE (example of the data below). Using while takes too long and I can't figure out how to compare just one row at a time. I've tried some variations of the following. So are you trying to compare the firs

Re: [PHP] fgetcsv

2008-01-09 Thread Daniel Brown
On Jan 9, 2008 5:35 PM, Danny Brow <[EMAIL PROTECTED]> wrote: > Hi Everyone, > > I'm trying to compare a value to the first field in a csv fILE (example > of the data below). Using while takes too long and I can't figure out > how to compare just one row at a time. I've tried some variations of the

Re: [PHP] fgetcsv

2008-01-09 Thread Jim Lucas
Danny Brow wrote: Hi Everyone, I'm trying to compare a value to the first field in a csv fILE (example of the data below). Using while takes too long and I can't figure out how to compare just one row at a time. I've tried some variations of the following. //Common for all trials $demoID = fop

[PHP] fgetcsv

2008-01-09 Thread Danny Brow
Hi Everyone, I'm trying to compare a value to the first field in a csv fILE (example of the data below). Using while takes too long and I can't figure out how to compare just one row at a time. I've tried some variations of the following. //Common for all trials $demoID = fopen("newDemoID.csv",

RE: [PHP] fgetcsv() excel data missing

2005-02-18 Thread Richard Lynch
Binoy AV wrote: > Could anybody please tell me how to read the data from an excel file ? > It should work independent of the operating system. I don't want the csv > format. For your first step, you'll have to convince Microsoft to OpenSource their code... Oh, yeah. You can't do that. :-) --

Re: [PHP] fgetcsv() excel data missing

2005-02-18 Thread Bret Hughes
On Fri, 2005-02-18 at 09:12, M. Sokolewicz wrote: > Binoy AV wrote: > > > Thanks Jay. > > > > Could anybody please tell me how to read the data from an excel file ? It should work independent of the operating system. I don't want the csv format. > excel files aren't independent of the OS,

Re: [PHP] fgetcsv() excel data missing

2005-02-18 Thread M. Sokolewicz
Binoy AV wrote: Thanks Jay. Could anybody please tell me how to read the data from an excel file ? It should work independent of the operating system. I don't want the csv format. excel files aren't independent of the OS, csv files are. Excel files need to be parsed, because they contain he

RE: [PHP] fgetcsv() excel data missing

2005-02-18 Thread Jay Blanchard
[snip] Could anybody please tell me how to read the data from an excel file ? It should work independent of the operating system. I don't want the csv format. [/snip] Start here http://us4.php.net/com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/u

RE: [PHP] fgetcsv() excel data missing

2005-02-18 Thread Binoy AV
Thanks Jay. Could anybody please tell me how to read the data from an excel file ? It should work independent of the operating system. I don't want the csv format. Binoy __ __ __ __ Sent via the WebMail system at softwareassociates.co

RE: [PHP] fgetcsv() excel data missing

2005-02-18 Thread Jay Blanchard
[snip] Thanks for the reply. It shows ÐÏࡱá>\\þÿ etc. source code I used is $handle = fopen ("file.xls","r"); while ($data = fgetcsv ($handle, 1000, ",")) { $num = count($data); for ($c=0; $c < $num ; $c++) { $str_email = $data[$c]; ec

RE: [PHP] fgetcsv() excel data missing

2005-02-18 Thread Binoy AV
Hi, Thanks for the reply. It shows ÐÏࡱá>\\þÿ etc. source code I used is $handle = fopen ("file.xls","r"); while ($data = fgetcsv ($handle, 1000, ",")) { $num = count($data); for ($c=0; $c < $num ; $c++) { $str_email = $data[$c]; echo $st

RE: [PHP] fgetcsv() excel data missing

2005-02-18 Thread Jay Blanchard
[snip] I used fgetcsv() function to get the data from a excel file. While reading the data it shows some special characters . I found the same problems in http://bugs.php.net/bug.php?id=12127&edit=2 Is it a bug? [/snip] What special characters does it show? -- PHP General Mailing List

[PHP] fgetcsv() excel data missing

2005-02-18 Thread Binoy AV
Hi all, I used fgetcsv() function to get the data from a excel file. While reading the data it shows some special characters . I found the same problems in http://bugs.php.net/bug.php?id=12127&edit=2 Is it a bug? Plz help me. Binoy __ __ __ _

Re: [PHP] fgetcsv

2003-11-16 Thread Derek Ford
zhuravlev alexander wrote: Hello. I wonder if PHP has fgetcsv() function why doesn't PHP has fputcsv ? -- zhuravlev alexander u l s t u n o c ([EMAIL PROTECT

[PHP] fgetcsv

2003-11-16 Thread zhuravlev alexander
Hello. I wonder if PHP has fgetcsv() function why doesn't PHP has fputcsv ? -- zhuravlev alexander u l s t u n o c ([EMAIL PROTECTED]) -- PHP Gen

Re: [PHP] fgetcsv quit working......

2003-03-09 Thread CDitty
I thought about this possibility, but it turns out 4 different scripts on the same server accessing different files from different locations and using different methods are all failing. Chris At 07:53 PM 3/9/2003, Jason Sheets wrote: Check to make sure the file exists, you should probably throu

Re: [PHP] fgetcsv quit working......

2003-03-09 Thread Jason Sheets
Check to make sure the file exists, you should probably through some debug code around the area that is failing. Jason On Sun, 2003-03-09 at 18:50, CDitty wrote: > I have a customer who's webhost upgraded their server recently and a script > that was working fine quit working. The error they are

[PHP] fgetcsv quit working......

2003-03-09 Thread CDitty
I have a customer who's webhost upgraded their server recently and a script that was working fine quit working. The error they are getting is this "fgetcsv(): supplied argument is not a valid stream resource". I don't know what they did with Apache, but as far as I know, nothing else changed.

Re: [PHP] fgetcsv Help

2002-12-12 Thread @ Edwin
Hello, "Justin French" <[EMAIL PROTECTED]> wrote: [snip] > Sample line from your CSV should look like this: > > --- > "1","foo","harry said \"what is it?\"","foo" > "1","bah","\"don't know\" said sally","something" > --- > > When echoing these values to the browser, you would strip the slashes.

Re: [PHP] fgetcsv Help

2002-12-11 Thread Richard Baskett
I did email the company that the csv feed is coming from so we'll see what comes of that. I really hope they fix it. Well here is what I did to solve the problem: I pulled the csv file in using file(), then found the string length, used substr() to get rid of the first double quote in the line a

Re: [PHP] fgetcsv Help

2002-12-11 Thread Justin French
How is the CSV being generated? Seems to me like your problem isn't ggetcsv(), but rather the file itself. Commonly, a CSV file is a series of values, separated by a comma (duh!!). The separated values are generally enclosed in double quotes ("), as it would appear yours are. Any double quotes

Re: [PHP] fgetcsv Help

2002-12-11 Thread DL Neil
Richard, > I am parsing a csv file with fgetcsv and the fields are surrounding by > double quotes, now I am running into a problem periodically that when there > are quotes within the value it is treating it like another value instead of > the same value. > Any ideas on how to get around that? > >

[PHP] fgetcsv Help

2002-12-11 Thread Richard Baskett
I am parsing a csv file with fgetcsv and the fields are surrounding by double quotes, now I am running into a problem periodically that when there are quotes within the value it is treating it like another value instead of the same value. Any ideas on how to get around that? I am thinking I might

[PHP] fgetcsv and end of line in values

2002-11-07 Thread svenie
greetings, i have problems using fgetcsv to explode a .csv file. some values consist of line-breaks. although these values are enclosed by quotes, php recognizes the line-break and starts a new dataset. the script workes fine in my old environment (win2k, apache 1.3.23, php 4.1.1), the problem

Re: [PHP] fgetcsv or other

2002-10-12 Thread @ Edwin
Hello, Just remember that fgetcsv() returns an array. So the first column is $thearray[0]; You can just pass it to the function that generates the image BEFORE you go to the next line of your csv file. Or, am I missing something? - E On Saturday, October 12, 2002 2:05 AM Bryan Koschmann wr

[PHP] fgetcsv or other

2002-10-11 Thread Bryan Koschmann - GKT
Hi, I need to read from a csv file (with quotes). I use the example from the manual, and it does spit it out how I want it, but I need to access one of the fields and pass that data to something else. So it's like this, I need my csv file to be displayed in a table, but the last column will cont

[PHP] fgetcsv With a String?

2002-05-14 Thread Jonathan Rosenberg
Is there any way that I can use fgetcsv, but have it get its input from a string, instead of using a file pointer? >From the online docs, there doesn't seem to be a way, but I thought I'd check with the list. -- JR -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http:

RE: [PHP] fgetcsv

2001-05-13 Thread Jason Murray
> Thanks - what I want to do is just say something like > fputcsv($myarray) - and not have to worry about putting in the > commas or whatever myself... will fputs do that? > > (In case it wasn't clear - I'm wanting to write back to the > file, having already read from it using fgetcsv) How ab

RE: [PHP] fgetcsv

2001-05-13 Thread Steve Wade
PHP News Subject: RE: [PHP] fgetcsv > Hi all - just wondering if anyone knows of a function like > fputcsv - that is, writes a line to a csv file - opposite of fgetcsv. A CSV file is just a text file with a different file extension, so you can use fgets to write it out... Jason -- PHP

RE: [PHP] fgetcsv

2001-05-13 Thread Jason Murray
> Hi all - just wondering if anyone knows of a function like > fputcsv - that is, writes a line to a csv file - opposite of fgetcsv. A CSV file is just a text file with a different file extension, so you can use fgets to write it out... Jason -- PHP General Mailing List (http://www.php.net/)

[PHP] fgetcsv

2001-05-13 Thread Steve Wade
Hi all - just wondering if anyone knows of a function like fputcsv - that is, writes a line to a csv file - opposite of fgetcsv. Any help would be appreciated :-) swadie ~~~ Steve Wade Youth Outreach Coordinator Fusion Australia Ltd (Sydney North)