|  Topic awaiting preservation: Undefined offset (Page 1 of 1)  | |
|---|---|
| Neurotic (0) Inmate Newly admitted From:  |  posted 08-30-2010 11:02 Hi there, code: if (substr($fields[11],0,strlen($countryicao)) == $countryicao OR substr($fields[13],0,strlen($countryicao)) == $countryicao) {
                        array_push($pilots, $fields);
 | 
| Maniac (V) Mad Scientist with Finglongers From: Germany |  posted 08-30-2010 12:24 so $fields does not contain 13 entries. You will need to stick a var_dump($fields); into th line before that to see what's actually in there, and it would really help if you had an idea what should be in there... | 
| Obsessive-Compulsive (I) Inmate From:  |  posted 08-30-2010 14:51 well the strange thing is that it start working again a few hours ago, the script it self is just anoying, is there not a way to disable the warning message. or if $fieldsB is empty that he don't show an error? | 
| Maniac (V) Mad Scientist with Finglongers From: Germany |  posted 08-30-2010 14:57 stick an @ before $fieldsB (or before the substr... my PHP is rusty). | 
| Maniac (V) Mad Scientist From: Belgrade, Serbia |  posted 08-30-2010 16:13 To suppress errors from functions, you need to prefix them with @ (as TP mentioned), i.e. @substr(...) code: if ((count($fields) >= 14 && substr($fields[13],0,strlen($countryicao)) == $countryicao) || (count($fields) >= 12 && substr($fields[11],0,strlen($countryicao)) == $countryicao)) { ... } | 
| Maniac (V) Mad Scientist with Finglongers From: Germany |  posted 08-30-2010 20:05 nah, the proper way would be to figure out why the array suddenly contains fewer elements than before... | 
| Maniac (V) Mad Scientist From: Belgrade, Serbia |  posted 08-31-2010 04:15 I just suggested an easy way out  | 
| Maniac (V) Mad Scientist with Finglongers From: Germany |  posted 08-31-2010 09:43 and I say, if you want to kludge, use the most prominent one available, which would be the '@'.  |