[Function] Convert Forum ID

This forum is now closed as part of retiring phpBB2.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
Post Reply
war-hawk
Registered User
Posts: 309
Joined: Sat Dec 11, 2004 4:48 pm
Contact:

[Function] Convert Forum ID

Post by war-hawk » Mon Aug 29, 2005 11:19 pm

I am always using this to convert forum_ids to the name of the forum so here it is.

Code: Select all

function convert_forum_id($id)
{
   global $db;

   $id = intval($id);

   $sql = "SELECT forum_name FROM " . FORUMS_TABLE . " WHERE forum_id = " . $id;
   
   if ( !$result = $db->sql_query($sql) )
   {
      message_die(GENERAL_ERROR, 'No Forum Name could be obtained', '', __LINE__, __FILE__, $sql);
   }

   while ( $row = $db->sql_fetchrow($result) )
   {
   $forum_name = $row['forum_name'];
   }
   
   return $forum_name;
}
and to call the function use this

Code: Select all

$forumid = convert_forum_id(28);
28 I used as an example for the forum_id
My Computer Help Site | Also known as Burian
No Support PMs Please UNLESS its about one of my mods!!!
THAT MEANS CONTACT THROUGH AIM AND MSN

My Mods| Member Area | Form to Post | User Message| Forum/Topic Ban |

war-hawk
Registered User
Posts: 309
Joined: Sat Dec 11, 2004 4:48 pm
Contact:

Post by war-hawk » Thu Dec 08, 2005 2:28 am

disregard...hit reply instead of new topic.
My Computer Help Site | Also known as Burian
No Support PMs Please UNLESS its about one of my mods!!!
THAT MEANS CONTACT THROUGH AIM AND MSN

My Mods| Member Area | Form to Post | User Message| Forum/Topic Ban |

Post Reply

Return to “[2.0.x] MOD Writers Discussion”