Re: undefined offset

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

 



Thanks.  That was it  -my last line was null.
----- Original Message ----- From: "Stuart Dallas" <stuart@xxxxxxxx>
To: "Jim Giner" <jim.giner@xxxxxxxxxxxxxxxxxx>
Cc: <php-general@xxxxxxxxxxxxx>
Sent: Thursday, April 26, 2012 4:21 PM
Subject: Re:  undefined offset


On 26 Apr 2012, at 21:20, Jim Giner wrote:

Sorry - can't seem to find anything that explains this on google.

I'm using a List command to break out an array into distinct field names. I
keep getting these errors as I go thru my loop::

Notice: Undefined offset: 10 in (.....) on line 151
Notice: Undefined offset: 9 in (.....) on line 151
Notice: Undefined offset: 8 in (.....) on line 151
Notice: Undefined offset: 7 in (.....) on line 151
Notice: Undefined offset: 6 in (.....) on line 151
Notice: Undefined offset: 5 in (.....) on line 151
Notice: Undefined offset: 4 in (.....) on line 151
Notice: Undefined offset: 3 in (.....) on line 151
Notice: Undefined offset: 2 in (.....) on line 151
Notice: Undefined offset: 1 in (.....) on line 151

The array is loaded with
 while ($line = fgetcsv($hdlin))

My trouble line of code is:
  list($LastName, $FirstName,$MI, $Eventcode,$Event_Partner_Ln,
$Event_Partner_Fn, $Event_Partner_MI,$t,$u,$v,$Draw_pos) = $line;

I've confirmed that I have a field name for each element in my rows.  All
the rows are the same size naturally.  So - what is it telling me?

For every iteration of the loop or just once? If it's just once then you're not handling the possibility of a blank line. If more than once then the file doesn't contain what you think it contains.

-Stuart

--
Stuart Dallas
3ft9 Ltd
http://3ft9.com/




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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux