function getgroup($id, $type = "")
{
    $dw = new Dedesql(false);
    $query1 = "select * from #@__group";
    $dw->SetQuery($query1);
    $dw->Execute();
    $rowcount = $dw->GetTotalRow();
    if ($rowcount == 0) {
        echo "<a href='guest_group.php?action=new'>请先添加会员分组</a>";
    } else {
        if ($type != '') {
            $dw->setquery("select * from #@__group where id='{$id}'");
            $dw->execute();
            $row1 = $dw->getone();
            return $row1['groupname'];
        } else {
            echo "<select name=\"g_group\">";
            while ($row1 = $dw->GetArray()) {
                if ($id == '' || $row1['id'] != $id) {
                    echo "<option value='" . $row1['id'] . "'>" . $row1['groupname'] . "</option>";
                } else {
                    echo "<option value='" . $row1['id'] . "' selected>" . $row1['groupname'] . "</option>";
                }
            }
            echo "</select>";
        }
    }
    $dw->close();
}