<?php

$name1 = 0;
$name2 = 0;
$name3 = 0;
$name4 = 0;

$result = mysql_query("SELECT * FROM $grouptable WHERE ynGroupMaster = '2'" );
$num_rows = mysql_num_rows( $result );
while ( $a_row = mysql_fetch_object( $result ) )
{
    $name1 = $a_row->strGrimforumName;
}

$result = mysql_query( "SELECT * FROM $grouptable WHERE intId = '$groupid'" );
$num_rows = mysql_num_rows( $result );
while ( $a_row = mysql_fetch_object( $result ) )
{
    $maingroupid = $a_row->intGroupId;
    $name3 = $a_row->strName;
}

$result = mysql_query( "SELECT * FROM $grouptable WHERE  intGroupId = '$maingroupid'" );
$num_rows = mysql_num_rows( $result );
while ( $a_row = mysql_fetch_object( $result ) )
{
    if ( $a_row->ynGroupMaster == 1 )
    {
        $name2 = $a_row->strName;
    }
}

$result=mysql_query("SELECT * FROM $forumtable WHERE intTopicId = '$topicid' AND ynTopicRow = 'Yes'");
$num_rows = mysql_num_rows( $result );
while ( $a_row = mysql_fetch_object( $result ) )
{
    $name4 = $a_row->strTopicName;
}

if ($name1 == "0" OR $name1 == "")
{
    $name1 = "?";
}
if ($name2 == "0" OR $name2 == "")
{
    $name2 = "All Forums";
}
if ($name3 == "0" OR $name3 == "")
{
    $name3 = "Unknown Topic";
}
if ($name4 == "0" OR $name4 == "")
{
    $name4 = "?";
}

?>