当前位置: 首页>>代码示例>>PHP>>正文


PHP DBLayer::drop_field方法代码示例

本文整理汇总了PHP中DBLayer::drop_field方法的典型用法代码示例。如果您正苦于以下问题:PHP DBLayer::drop_field方法的具体用法?PHP DBLayer::drop_field怎么用?PHP DBLayer::drop_field使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DBLayer的用法示例。


在下文中一共展示了DBLayer::drop_field方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: DBLayer

        //DBlayers switched table, so $db must be re-introduced
        $db = new DBLayer($db_host, $db_username, $db_password, $db_name, $db_prefix, false);
        while ($row = $imp->fetch_assoc($cat_query)) {
            $query = array('INSERT' => 'title, description, active, father_id, old_id, old_id_backup', 'INTO' => 'categories', 'VALUES' => '"' . $row['title'] . '", "' . $row['description'] . '", 1, "' . $row['ref'] . '", "' . $row['id'] . '", "' . $row['id'] . '"');
            $db->query_build($query) or error(__FILE__, __LINE__);
        }
        while ($lrow = $imp->fetch_assoc($link_query)) {
            $query = array('SELECT' => 'id', 'FROM' => 'categories', 'WHERE' => 'old_id=' . $lrow['ref']);
            $new_cat_id = $db->query_build($query) or error(__FILE__, __LINE__);
            $new_cat_id = $db->fetch_row($new_cat_id);
            $query = array('INSERT' => 'title, url, description, active, category_id, ip, type, payment_status, old_category_id_backup', 'INTO' => 'links', 'VALUES' => '"' . $lrow['title'] . '", "' . $lrow['url'] . '", "' . $lrow['description'] . '", ' . ($lrow['accepted'] == 'y' ? 1 : 0) . ', ' . $new_cat_id[0] . ',  "' . $lrow['ip'] . '", "a", "ok", ' . $lrow['category']);
            $db->query_build($query) or error(__FILE__, __LINE__);
        }
        //re-sort father_ids
        $query = array('UPDATE' => 'categories', 'SET' => 'father_id=' . intval($_POST['category_id']), 'WHERE' => 'father_id=0 AND old_id<>0');
        $db->query_build($query) or error(__FILE__, __LINE__);
        $query = array('SELECT' => 'id, father_id, old_id', 'FROM' => 'categories', 'WHERE' => 'father_id <> ' . intval($_POST['category_id']) . ' AND old_id<>0 ORDER BY father_id ASC');
        $sql_resort = $db->query_build($query) or error(__FILE__, __LINE__);
        while ($res = $db->fetch_assoc($sql_resort)) {
            $query = array('SELECT' => 'id', 'FROM' => 'categories', 'WHERE' => 'old_id=' . $res['father_id']);
            $get_id = $db->query_build($query) or error(__FILE__, __LINE__);
            $get_id = $db->fetch_row($get_id);
            $query = array('UPDATE' => 'categories', 'SET' => 'father_id=' . intval($get_id[0]), 'WHERE' => 'id=' . $res['id']);
            $db->query_build($query) or error(__FILE__, __LINE__);
        }
        $imp_result = "Links and categories have now been imported from Free PHP Directory Script";
    } else {
        $imp_result = "Script '" . $_POST['directory_script'] . "' is not supported";
    }
    $db->drop_field('categories', 'old_id');
}
开发者ID:Dawzz,项目名称:Open-Link-Directory,代码行数:31,代码来源:index.php


注:本文中的DBLayer::drop_field方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。