count() multidimensional array
| From: | Dean Martin | Date: | Sat, 19 May 2001 15:18:19 +0000 |
| Subject: | count() multidimensional array | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-53527@lists.php.net to get a copy of this message | ||
I have a multidimensional array being created by a form. Most fields are
pre-populated with a few that people can add to the list. There is a box
beside each row that they can check whether that item is in or not.
My code to list only the rows that were checked is this..
for ($j=1 ; $j=5; $j++)
{
for ($i=0 ; $i<count($check[$j]) ; $i++)
{
if ($check[$j][$i] == "1")//was boxed checked?
{
$message .= "$pre[$j][$i]. .$post[$j][$i]. .$name[$j][$i].
.$city[$j][$i]. .$state[$j][$i]\n";
}
}
}
This code is creating an endless loop and times out the server with memory
overruns.
What am I missing?