本文整理汇总了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');
}