Re: undefined offset
| From: | Stuart Dallas | Date: | Thu, 26 Apr 2012 20:21:58 +0000 |
| Subject: | Re: undefined offset | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-317706@lists.php.net to get a copy of this message | ||
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/