當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。