本文整理汇总了PHP中cat_update函数的典型用法代码示例。如果您正苦于以下问题:PHP cat_update函数的具体用法?PHP cat_update怎么用?PHP cat_update使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cat_update函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: clear_cache_files
$db->query("UPDATE " . $ecs->table('nav') . "SET ifshow = 0 WHERE ctype = 'c' AND cid = '" . $id . "' AND type = 'middle'");
}
clear_cache_files();
make_json_result($val);
} else {
make_json_error($db->error());
}
}
/*------------------------------------------------------ */
//-- 切换是否显示
/*------------------------------------------------------ */
if ($_REQUEST['act'] == 'toggle_is_show') {
check_authz_json('cat_manage');
$id = intval($_POST['id']);
$val = intval($_POST['val']);
if (cat_update($id, array('is_show' => $val)) != false) {
clear_cache_files();
make_json_result($val);
} else {
make_json_error($db->error());
}
}
/*------------------------------------------------------ */
//-- 删除商品分类
/*------------------------------------------------------ */
if ($_REQUEST['act'] == 'remove') {
check_authz_json('cat_manage');
/* 初始化分类ID并取得分类名称 */
$cat_id = intval($_GET['id']);
$cat_name = $db->getOne('SELECT cat_name FROM ' . $ecs->table('category') . " WHERE cat_id='{$cat_id}'");
/* 当前分类下是否有子分类 */
示例2: clear_cache_files
$db->query("DELETE FROM " . $ecs->table('nav') . "WHERE ctype = 'a' AND cid = '{$id}' AND type = 'middle'");
clear_cache_files();
admin_log($cat_name, 'remove', 'category');
}
$url = 'articlecat.php?act=query&' . str_replace('act=remove', '', $_SERVER['QUERY_STRING']);
ecs_header("Location: {$url}\n");
exit;
}
/*------------------------------------------------------ */
//-- 切换是否显示在导航栏
/*------------------------------------------------------ */
if ($_REQUEST['act'] == 'toggle_show_in_nav') {
check_authz_json('cat_manage');
$id = intval($_POST['id']);
$val = intval($_POST['val']);
if (cat_update($id, array('show_in_nav' => $val)) != false) {
if ($val == 1) {
//显示
$nid = $db->getOne("SELECT id FROM " . $ecs->table('nav') . " WHERE ctype='a' AND cid='{$id}' AND type = 'middle'");
if (empty($nid)) {
//不存在
$vieworder = $db->getOne("SELECT max(vieworder) FROM " . $ecs->table('nav') . " WHERE type = 'middle'");
$vieworder += 2;
$catname = $db->getOne("SELECT cat_name FROM " . $ecs->table('article_cat') . " WHERE cat_id = '{$id}'");
$uri = build_uri('article_cat', array('acid' => $id), $_POST['cat_name']);
$sql = "INSERT INTO " . $ecs->table('nav') . " (name,ctype,cid,ifshow,vieworder,opennew,url,type) " . "VALUES('" . $catname . "', 'a', '{$id}','1','{$vieworder}','0', '" . $uri . "','middle')";
} else {
$sql = "UPDATE " . $ecs->table('nav') . " SET ifshow = 1 WHERE ctype='a' AND cid='{$id}' AND type = 'middle'";
}
$db->query($sql);
} else {