Comparing a variable against an array and outputting data from a directly proportional array I can't see why the code isn't working. I have tried echoing variables at almost all stages but I can't get my head around it.
This code populates the arrays.
$sqlquery = "SELECT forum_name, forum_id FROM phpbb_forums";
$result = $db->sql_query($sqlquery);
$f_num = 0;
$forumid = array();
$forumname = array();
while ( ($row = $db->sql_fetchrow($result)))
$forumid[$f_num] = $row["forum_id"];
$forumname[$f_num] = $row["forum_name"];
then another query is performed which is most of the output is generated. then this is the code that I'm having problems with
while ( $f_num > 0 )
if ( $row["forum_id"] == $forumid[$f_num] )
$f_name = $forumname[$f_num];
$f_id_num = $f_num;
This code needs to replace $row['forum_id'] with the correct variable from the $forumname array each time "while ( ($row = $db->sql_fetchrow($result)))" runs.