I am using a nested while loop to create a nested array that will look like this:
[276] => Array
(
[0] => 302
)
[279] => Array
(
[0] => 290
[1] => 291
[1] => 223
But for some reason I am only getting one nested array showing up under 279 but I know the data I am querying is returning at least 12 records that should be under the 279 array.
Here is my while loop code:
while ($row = mysql_fetch_assoc($result)) {
$term_id = $row[term_id];
// Look up Children Categories
$sql2 = "SELECT * FROM wp_term_taxonomy wpt where parent = $row[term_id]";
// execute query:
$result2 = mysql_query($sql2) or die('A error occured: ' . mysql_error());
// fetch results:
$count_2 = "0";
while ($row2 = mysql_fetch_assoc($result2)) {
$term_id2 = $row2['term_id'];
$arr[$term_id] = array($count_2 => $row2[term_id]);
$count_2++;
}
}
Can someone tell me what Im doing wrong? Its like the nested array resets each time so I just get one record under the nested array.