I'm having some trouble with a nesting for loops that is driving me crazy. $sectionRS["id"] is being taken straight from a db table. $section_output[$y] is a pipe-delimited value from a db row, which I am exploding, counting the elements, and looping through first. each of those values I am checking against the db table values to see if they match. It all seems very simple and it seems like this should work, but it doesn't. Any advice would be appreciated.
Marty
for ($y = 0; $y < $section_count; $y++) {
for ($z = 0; $z < $num_results; $z++) {
$sectionRS = mysql_fetch_array($sections);
// this is where things aren't working. it seems like it should work, but the $section_output value is always adding to itself, so i get "111" instead of "1"
if ($sectionRS["id"] == $section_output[$y]) {
echo $sectionRS["name"];
}
echo $sectionRS["id"]; // this outputs the correct data
}
echo $section_output[$y]; // this outputs the correct data
}