1. 论坛系统升级为Xenforo,欢迎大家测试!
    排除公告

懂数据库的朋友帮我

本帖由 lukeliu2005-09-15 发布。版面名称:后端开发

  1. lukeliu

    lukeliu New Member

    注册:
    2005-09-07
    帖子:
    29
    赞:
    0
    见第三楼求助 谢谢!~
     
    #1 lukeliu, 2005-09-15
    最后编辑: 2005-09-15
  2. 小叶

    小叶 New Member

    注册:
    2005-09-04
    帖子:
    17,941
    赞:
    33
    不上那边解答问题的..
     
  3. 老林

    老林 New Member

    注册:
    2005-09-06
    帖子:
    10,580
    赞:
    36
    基本同意楼上的说法...
     
  4. lukeliu

    lukeliu New Member

    注册:
    2005-09-07
    帖子:
    29
    赞:
    0
    请懂数据库的的朋友帮我!在线等谢谢!vbb联盟论坛问题!

    请懂数据库的的朋友帮我!在线等谢谢!vbb联盟论坛问题!

    我的vbb数据库的前缀:"vbb" 例如:
    vbbbbcode
    vbbcalendar
    vbbcalendarcustomfield
    那么我想让联盟论坛的sitelink也是vbb前缀 改下面的什么地方(在什么地方加"vbb")


    QUOTE:
    DROP TABLE IF EXISTS `sitelink`;
    CREATE TABLE `sitelink` (
    `sitelinkid` int(10) NOT NULL auto_increment,
    `title` varchar(255) NOT NULL default '',
    `url` varchar(255) NOT NULL default '',
    `logourl` varchar(255) NOT NULL default '',
    `desc` mediumtext NOT NULL,
    `displayorder` smallint(5) NOT NULL default '0',
    PRIMARY KEY (`sitelinkid`)
    ) TYPE=MyISAM;


    还有sitelink文件怎么改?


    PHP:
    <?php

    // ######################## SET PHP ENVIRONMENT ###########################
    error_reporting(E_ALL & ~E_NOTICE);

    // ##################### DEFINE IMPORTANT CONSTANTS #######################
    define('NO_REGISTER_GLOBALS'1);

    // #################### PRE-CACHE TEMPLATES AND DATA ######################
    $phrasegroups = array('cppermission');
    $specialtemplates = array();

    // ########################## REQUIRE BACK-END ############################
    require_once('./global.php');

    // ############################# LOG ACTION ###############################
    $vbulletin->input->clean_array_gpc('r', array(
            
    'sitelinkid'         => TYPE_INT
    ));
    log_admin_action(iif($vbulletin->GPC['sitelinkid'] != 0"sitelink id = " $vbulletin->GPC['sitelinkid']));

    // ########################################################################
    // ######################### START MAIN SCRIPT ############################
    // ########################################################################

    print_cp_header('联盟论坛管理');

    if (empty(
    $_REQUEST['do']))
    {
            
    $_REQUEST['do'] = 'modify';
    }

    // ###################### Start edit #######################
    if ($_REQUEST['do'] == 'edit')
    {
            
    print_form_header('sitelink''update');
            if (isset(
    $_REQUEST['sitelinkid']))
            {
                    
    $sitelink $db->query_first("SELECT * FROM " TABLE_PREFIX "sitelink WHERE sitelinkid = " intval($_REQUEST['sitelinkid']));
                    
    print_table_header(construct_phrase($vbphrase['x_y_id_z'], '联盟论坛'$sitelink['title'], $sitelink['sitelinkid']));
                    
    construct_hidden_code('sitelinkid' $sitelink['sitelinkid']);
            }
            else
            {
                    
    $sitelink['url'] = 'http://';
                    
    $sitelink['logourl'] = 'http://';
                    
    print_table_header('添加新联盟论坛');
            }
            
            
    print_input_row('名称''title'$sitelink['title']);
            
    print_input_row('链接''url'$sitelink['url']);
            
    print_input_row('图标链接<dfn>如果填写图标链接而没有填写描述,则该联盟论坛链接为图像链接</dfn>''logourl'$sitelink['logourl']);
            
    print_textarea_row('描述<dfn>如果填写描述,该联盟论坛将会占用表格一整行的空间</dfn>''desc'$sitelink['desc']);
            
    print_input_row('显示顺序''displayorder'$sitelink['displayorder']);
            
    print_submit_row($vbphrase['save']);
    }

    // ###################### Start do update #######################
    if ($_POST['do'] == 'update')
    {
            
    $vbulletin->input->clean_array_gpc('p', array(
                    
    'title' => TYPE_STR,
                    
    'url' => TYPE_STR,
                    
    'logourl' => TYPE_STR,
                    
    'desc' => TYPE_STR,
                    
    'sitelinkid' => TYPE_INT,
                    
    'displayorder' => TYPE_INT,
            ));
            
            
            if (empty(
    $vbulletin->GPC['sitelinkid']))
            {
                    
    // add new
                    
    $db->query("
                            INSERT INTO " 
    TABLE_PREFIX "`sitelink`
                            (`title`, `url`, `logourl`, `desc`, `displayorder`)
                            VALUES
                            ('" 
    $vbulletin->GPC['title'] . "', '" $vbulletin->GPC['url'] . "', '" $vbulletin->GPC['logourl'] . "','" $vbulletin->GPC['desc'] . "','" $vbulletin->GPC['displayorder'] . "')
                    "
    );        
            }
            else
            {
                    
    // update
                    
    $db->query("
                            UPDATE " 
    TABLE_PREFIX "`sitelink`
                            SET `title` = '" 
    $vbulletin->GPC['title'] . "',
                            `url` = '" 
    $vbulletin->GPC['url'] . "',
                            `logourl` = '" 
    $vbulletin->GPC['logourl'] . "',
                            `desc` = '" 
    $vbulletin->GPC['desc'] . "',
                            `displayorder` = '" 
    $vbulletin->GPC['displayorder'] . "'
                            WHERE `sitelinkid` = " 
    $vbulletin->GPC['sitelinkid']
                    );
            }

            
    // 更新缓存
            
    $sitelinks $db->query("SELECT * FROM " TABLE_PREFIX "sitelink ORDER BY displayorder");
            while (
    $sitelink $db->fetch_array($sitelinks))
            {
                    
    $sitelinkcache[] = $sitelink;
            }
            
    build_datastore('sitelinkcache'serialize($sitelinkcache));
            
            
            
    define('CP_REDIRECT''sitelink.php?$session[sessionurl]do=modify');
            
    print_cp_message("保存联盟论坛{$title}成功"CP_REDIRECT);

    }

    // ###################### Start Update Display Order #######################
    if ($_POST['do'] == 'dodisplayorder')
    {
            
    $vbulletin->input->clean_array_gpc('r', array(
                    
    'order'         => TYPE_ARRAY
            
    ));
            
            if (
    is_array($order))
            {
                    
    $sitelinks $db->query("
                            SELECT sitelinkid,displayorder
                            FROM " 
    TABLE_PREFIX "sitelink
                    "
    );
                    while (
    $sitelink $db->fetch_array($sitelinks))
                    {
                            
    $displayorder intval($order["$sitelink[sitelinkid]"]);
                            if (
    $sitelink['displayorder'] != $displayorder)
                            {
                                    
    $db->query("
                                            UPDATE " 
    TABLE_PREFIX "sitelink
                                            SET displayorder = 
    $displayorder
                                            WHERE sitelinkid = 
    $sitelink[sitelinkid]
                                    "
    );
                            }
                    }
            }

            
    // 更新缓存
            
    $sitelinks $db->query("SELECT * FROM " TABLE_PREFIX "sitelink ORDER BY displayorder");
            while (
    $sitelink $db->fetch_array($sitelinks))
            {
                    
    $sitelinkcache[] = $sitelink;
            }
            
    build_datastore('sitelinkcache'serialize($sitelinkcache));


            
    define('CP_REDIRECT'"sitelink.php?$session[sessionurl]do=modify");
            
    print_stop_message('saved_display_order_successfully'CP_REDIRECT);
            
            
    }

    // ###################### Start Remove Sitelink #######################
    if ($_REQUEST['do'] == 'remove')
    {
            
    $vbulletin->input->clean_array_gpc('r', array(
                    
    'sitelinkid'         => TYPE_INT
            
    ));

            echo 
    "<p> </p><p> </p>\n";

            
    print_form_header('sitelink''kill');
            
    construct_hidden_code('sitelinkid'$vbulletin->GPC['sitelinkid']);
            
    print_table_header('确认删除?');
            
    print_description_row('<blockquote>您确认要删除该联盟论坛?</blockquote>');
            
    print_submit_row($vbphrase['delete'], ''2$vbphrase['go_back']);
    }

    // ###################### Start Kill #######################
    if ($_POST['do'] == 'kill')
    {
            
    $vbulletin->input->clean_array_gpc('r', array(
                    
    'sitelinkid'         => TYPE_INT
            
    ));

            
    $db->query("DELETE FROM " TABLE_PREFIX "sitelink WHERE sitelinkid = ".$vbulletin->GPC['sitelinkid']);

            
    // 更新缓存
            
    $sitelinks $db->query("SELECT * FROM " TABLE_PREFIX "sitelink ORDER BY displayorder");
            while (
    $sitelink $db->fetch_array($sitelinks))
            {
                    
    $sitelinkcache[] = $sitelink;
            }
            
    build_datastore('sitelinkcache'serialize($sitelinkcache));

            
            
    define('CP_REDIRECT'"sitelink.php?$session[sessionurl]do=modify");
            
    print_cp_message("删除联盟论坛成功"CP_REDIRECT);

    }

    // ###################### Start Modify Sitelinks #######################
    if ($_REQUEST['do'] == 'modify')
    {
            
    $sitelinks $db->query("SELECT * FROM " TABLE_PREFIX "sitelink ORDER BY displayorder");
            
            if (
    $db->num_rows($sitelinks))
            {
                    
    print_form_header('sitelink''dodisplayorder');
                    
    print_table_header('编辑联盟论坛'4);
                    
    print_cells_row(array('名称''图标'$vbphrase['display_order'], $vbphrase['controls']), 1);
                    
                    while (
    $sitelink $db->fetch_array($sitelinks))
                    {
                            
    $cell = array();
                            
    $cell[] = "<a href=\"$sitelink[url]\">$sitelink[title]</a>";
                            
    $cell[] = "<img src=\"$sitelink[logourl]\" border=\"0\"/>";
                            
    $cell[] = "<input type=\"text\" class=\"bginput\" name=\"order[$sitelink[sitelinkid]]\" value=\"$sitelink[displayorder]\" tabindex=\"1\" size=\"3\" />";
                            
    $cell[] =
                                    
    construct_link_code($vbphrase['edit'], "sitelink.php?$session[sessionurl]do=edit&sitelinkid=$sitelink[sitelinkid]").
                                    
    construct_link_code($vbphrase['delete'], "sitelink.php?$session[sessionurl]do=remove&sitelinkid=$sitelink[sitelinkid]");
                            
    print_cells_row($cell);
                    }
                    
                    
    print_submit_row($vbphrase['save_display_order'], NULL4);
                    echo 
    "<p align=\"center\">" construct_link_code('添加新联盟论坛'"sitelink.php?$session[sessionurl]do=edit")."</p>";

            }
            else
            {
                    
    print_stop_message("no_sitelink_found""sitelink.php?$session[sessionurl]do=add");
            }

    }

    print_cp_footer();

    ?>

    就是说在哪些变量前加"vbb"
    谢谢
     
    #4 lukeliu, 2005-09-15
    由版主最后编辑: 2005-09-15
  5. 小叶

    小叶 New Member

    注册:
    2005-09-04
    帖子:
    17,941
    赞:
    33
    野兽进来....

    `sitelink`;前面加
     
    #5 小叶, 2005-09-15
    最后编辑: 2005-09-15
  6. 小叶

    小叶 New Member

    注册:
    2005-09-04
    帖子:
    17,941
    赞:
    33
    野兽(82413778) 13:52:18
    PHP:
    DROP TABLE IF EXISTS `sitelink`;
    改成 DROP TABLE IF EXISTS `前缀_sitelink`;
    野兽(82413778) 13:52:37
    PHP:
    CREATE TABLE `sitelink`改CREATE TABLE `前缀_sitelink
    php文件里面都有. TABLE_PREFIX . 的