[Wylug-help] PHP foreach help

Gary Stainburn gary.stainburn at ringways.co.uk
Thu Nov 19 13:34:07 UTC 2009


Hi folks,

According to the doc's, referencing $dets in the first loop should make any 
changes made there appear in the second loop, i.e.

foreach ($List as &$dets) {
  if ($dets['current'] == 't') { $dets['tab']='live';}
  if ($dets['current'] == 'f') { $dets['tab']='dead';}
  ....
} # foreach
.....
.....
foreach ($List as &$dets){
  if ($User['defaults']['ff_tab'] == $dets['tab'] && !isset($dets['seen'])) {
    paint_line($dets);
    $dets['seen']=1;
  } 
}

However, I'm getting

PHP Notice:  Undefined index:  tab in /home/httpd/webroot/funding1.html on 
line 88,

Line 88 is the if statement inside the second look.

Can anyone see what I've done wrong.

Gary
-- 
Gary Stainburn

Gary's Haircut 700
Please visit http://www.justgiving.com/Gary-Stainburn/ to help me 
raise money for Cancer Research - in return I'll have my head shaved
 



More information about the Wylug-help mailing list