Пример #1
0
        mysql_query($sql);
        //END ---------------------------------------------------------------------------------------
    }
    print "成功刪除勾選資料!";
    exit;
} elseif ($check == 'del') {
    for ($i = 0; $i < count($id); $i++) {
        $unit->id = $id[$i];
        $unit->get_db_var();
        $unit->del();
        //刪除產品
        if ($unit->pic != $pic_no_pic) {
            @unlink($unit->pic);
        }
        //移除圖片
        remove_home_num($unit->id);
        //維持首頁勾選數量
        //CLEAN RELATED DATA UP BEGIN-----------------------------------------------------------------------
        //刪除圖片資料
        $sql = "select * from `{$pro_pic_table}` where `upid`='" . $id[$i] . "'";
        $res = mysql_query($sql);
        while ($row = mysql_fetch_array($res)) {
            @unlink($row['pic']);
            @unlink($row['s_pic']);
        }
        $sql = "DELETE from `{$pro_pic_table}` where `upid`='" . $id[$i] . "'";
        mysql_query($sql);
        //刪除檔案資料
        $sql = "select * from `{$pro_download_table}` where `upid`='" . $id[$i] . "'";
        $res = mysql_query($sql);
        while ($row = mysql_fetch_array($res)) {
Пример #2
0
function del_child($id)
{
    global $pro_class_table;
    global $product_table;
    global $pic_no_pic;
    global $pro_pic_table;
    global $pro_size_table;
    global $pro_color_table;
    global $pro_stock_table;
    global $pro_size_relate_table;
    global $pro_color_relate_table;
    global $pro_download_table;
    $unit2 = new product();
    $unit2->table = $product_table;
    $sql = "select id,pic,pic2 from `{$pro_class_table}` where upid='{$id}'";
    $res = mysql_query($sql);
    if (mysql_num_rows($res) > 0) {
        while ($row = mysql_fetch_array($res)) {
            if ($row['pic'] != $pic_no_pic) {
                @unlink($row['pic']);
            }
            //移除圖片
            if ($row['pic2'] != $pic_no_pic) {
                @unlink($row['pic2']);
            }
            //移除圖片
            del_child($row['id']);
        }
    }
    $sql = "DELETE from `{$pro_class_table}` where id='{$id}'";
    mysql_query($sql);
    $sql = "select id from `{$product_table}` where upid='{$id}'";
    $res = mysql_query($sql);
    while ($row = mysql_fetch_array($res)) {
        $unit2->id = $row['id'];
        $unit2->get_db_var();
        $unit2->del();
        //刪除產品
        remove_home_num($unit2->id);
        //維持首頁勾選數量
        if ($unit2->pic != $pic_no_pic) {
            @unlink($unit2->pic);
        }
        //移除圖片
        //CLEAN RELATED DATA UP BEGIN-----------------------------------------------------------------------
        //刪除其它圖片資料
        $sql2 = "select * from `{$pro_pic_table}` where `upid`='" . $unit2->id . "'";
        $res2 = mysql_query($sql2);
        while ($row2 = mysql_fetch_array($res2)) {
            @unlink($row2['pic']);
            @unlink($row2['s_pic']);
        }
        $sql = "DELETE from `{$pro_pic_table}` where `upid`='" . $unit2->id . "'";
        mysql_query($sql);
        //刪除檔案資料
        $sql2 = "select * from `{$pro_download_table}` where `upid`='" . $unit2->id . "'";
        $res2 = mysql_query($sql2);
        while ($row2 = mysql_fetch_array($res2)) {
            @unlink($row2['file']);
        }
        $sql = "DELETE from `{$pro_download_table}` where `upid`='" . $unit2->id . "'";
        mysql_query($sql);
        //刪除庫存資料
        $sql2 = "SELECT id from `{$pro_color_relate_table}` where `upid`='" . $unit2->id . "'";
        $res2 = mysql_query($sql2);
        while ($row2 = mysql_fetch_array($res2)) {
            $sql2 = "DELETE from `{$pro_stock_table}` where `upid`='" . $row2['id'] . "'";
            mysql_query($sql2);
        }
        //刪除顏色資料
        $sql = "DELETE from `{$pro_color_relate_table}` where `upid`='" . $unit2->id . "'";
        mysql_query($sql);
        //刪除大小資料
        $sql = "DELETE from `{$pro_size_relate_table}` where `upid`='" . $unit2->id . "'";
        mysql_query($sql);
        //END ---------------------------------------------------------------------------------------
    }
}
Пример #3
0
<?php

header("Content-Type:text/html;charset=UTF-8");
include "../../../session.php";
include "../../../system.php";
include "../../system.php";
$id = $_POST['id'];
$act = $_POST['act'];
$title = $_POST['title'];
$sql = "UPDATE `{$product_table}` SET `{$title}`='{$act}' where id='{$id}'";
mysql_query($sql);
if ($title == 'p_home' and $act == 1) {
    keep_home_num($id);
} elseif ($title == 'p_home' and $act == 0) {
    remove_home_num($id);
}