<?php
$admin = 2;
$file = __FILE__;
include ("../inc/inc_connect.php");
include ("../inc/inc_admincheck.php");

//find out forum ID and order number (and Date)

$date_array = getdate();
$dateofcreation = "$date_array[mday]/$date_array[mon]/$date_array[year]";

$result = mysql_query( "SELECT * FROM $grouptable ORDER BY intGroupId DESC LIMIT 0,1" );
$num_rows = mysql_num_rows( $result );
while ( $a_row = mysql_fetch_object( $result ) )
{
        $id = $a_row->intGroupId;
}

$result = mysql_query( "SELECT * FROM $grouptable ORDER BY intGroupOrder DESC LIMIT 0,1" );
$num_rows = mysql_num_rows( $result );
while ( $a_row = mysql_fetch_object( $result ) )
{
        $order = $a_row->intGroupOrder;
}

$id++;
$order++;

//set the new forum

$query = "INSERT INTO $grouptable ( intGroupId, IntGroupOrder, strName, strDateCreated, ynGroupMaster ) values ( '$id', '$order', '$name', '$dateofcreation', '1' )";

mysql_query( $query, $link )
or die ( "Could not update in \"$grouptable\" table: "
.mysql_error() );
mysql_close( $link);


header("Location: admin_setforums.php");
exit;