Hey there,

I'm having a little trouble with a for each loop i'm trying to use. I was hoping somebody would be able to pick out what i'm doing wrong.

I'm getting this error message Invalid argument supplied for foreach() on line 310, which is the line that the outer foreach is on. When i print_r on $gameData[$gdc] i get Array ( [Game] => 2 [Arena] => ARC [Level] => PeeWee [D] => 3 [Sex] => m [Start] => 00:07:30 [Time] => 00:01:15 [Date] => 2009-12-20 [System] => 3 [Official1] => [Official2] => [Official3] => ) 1 so it's obviously an array.

$gdc is a counter for the for loop that these foreach are sitting in. These for each are sitting in an IF statment and should only activate when data from a particular row meets the criteria. Then these foreach loops are supposed to create table data for that row.

foreach ($gameData[$gdc] as $tempVar) {
	foreach ($tempVar as $key => $value)
	       $storeTable .= "<td>$tempVar[$value]</td>\n";

Anyone have any idea how i'm botching this up?

Thanks so much,

8 Years
Discussion Span
Last Post by JimmyLloyd

Bah i figured it out. I didn't have to nest the foreach loops since i already specified the row by including the counter value with the variable name.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.