then it yields:$qry = $DB->Query("SELECT * FROM recipes WHERE type = '$type' ORDER +BY rand() limit $quantity") || die "Got error on select: $Mysql::db_errstr\n"; + for ($i=0; $i<$qry->numrows; $i++) { @row = $qry->fetchrow or warn "recipes didn't find a matching row" +; print "\@row is assigned @row\n"; $j = 0; foreach my $bug (@row) { $athlete[$i][$j++] = $bug ; print "\$i\$j is assigned $i:$j\n"; print "\$athlete[\$i,\$j] is assigned the value $athlete[$i][$j] +\n"; print "\$bug is assigned the value $bug\n"; } } }
@row is assigned 33 Small Bunch Grapes carb 15 0.4 0.1 $i$j is assigned 4:1 Use of uninitialized value in concatenation (.) or string at ./getCurr +entNeeds.pl line 74. $athlete[$i,$j] is assigned the value $bug is assigned the value 33 $i$j is assigned 4:2 Use of uninitialized value in concatenation (.) or string at ./getCurr +entNeeds.pl line 74. $athlete[$i,$j] is assigned the value $bug is assigned the value Small Bunch Grapes $i$j is assigned 4:3 Use of uninitialized value in concatenation (.) or string at ./getCurr +entNeeds.pl line 74. $athlete[$i,$j] is assigned the value $bug is assigned the value carb $i$j is assigned 4:4 Use of uninitialized value in concatenation (.) or string at ./getCurr +entNeeds.pl line 74. $athlete[$i,$j] is assigned the value $bug is assigned the value 15 $i$j is assigned 4:5 Use of uninitialized value in concatenation (.) or string at ./getCurr +entNeeds.pl line 74. $athlete[$i,$j] is assigned the value $bug is assigned the value 0.4 $i$j is assigned 4:6 Use of uninitialized value in concatenation (.) or string at ./getCurr +entNeeds.pl line 74. $athlete[$i,$j] is assigned the value $bug is assigned the value 0.1
In reply to Re: Re: Where is my foreach data going to?
by brotherdaniel
in thread Where is my foreach data going to?
by brotherdaniel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |