PHP-Code:
function malte($id) {
global $db, $altbg, $theme, $mybb, $postcounter;
global $titlescache, $page, $templates, $forumpermissions, $attachcache;
global $lang, $ismod, $inlinecookie, $inlinecount, $groupscache, $fid;
global $plugins, $parser, $cache;
$query = $db->query("SELECT `fid` , `pid`
FROM `mybb_forums`
WHERE `fid` =".$id."
LIMIT 0 , 1");
while($forumb = $db->fetch_array($query))
{
if($forumb['pid'] == 0)
{
$parent_id = $forumb['fid'];
echo $parent_id;
return $parent_id;
}
else
{
echo '<pre>$forumb'."\n";
print_r ($forumb);
echo '</pre><hr />';
malte($forumb['pid']);
}
}
}
PHP-Code:
$query = $db->query("SELECT `tid` , `fid`
FROM `mybb_threads`
WHERE `tid` =".$post['tid']."
LIMIT 0 , 1");
while($thema = $db->fetch_array($query))
{
$bid = malte($thema['fid']);
}
echo '<pre>Die Rückgabe'."\n";
echo $bid;
echo '</pre><hr />';
//edit
So scheint es zu gehen:
PHP-Code:
/** Unsere Behelfsfunktion für Moderatoren */
function malte($id) {
global $db, $altbg, $theme, $mybb, $postcounter;
global $titlescache, $page, $templates, $forumpermissions, $attachcache;
global $lang, $ismod, $inlinecookie, $inlinecount, $groupscache, $fid;
global $plugins, $parser, $cache;
$query = $db->query("SELECT `fid` , `pid`
FROM `mybb_forums`
WHERE `fid` =".$id."
LIMIT 0 , 1");
while($forumb = $db->fetch_array($query))
{
if($forumb['pid'] == 0)
{
$parent_id = $forumb['fid'];
return $parent_id;
}
else
{
$parent_id = malte($forumb['pid']);
return $parent_id;
}
}
}