#---- 刪除商品資料
case "opDelete":
opDelete($sn);
XoopsCache::clear();
redirect_header($_SESSION['return_url'], 3, _BP_DEL_SUCCESS);
exit;
```
二、函數
1. opDelete($sn) ```
#########################################
# 刪除資料
#########################################
function opDelete($sn = "") {
global $xoopsDB, $module_name;
if (empty($sn)) {
redirect_header($_SESSION['return_url'], 3, _BP_DEL_ERROR);
}
#檢查
$sql = "delete from " . $xoopsDB->prefix("cnu_show_prod") . "
where sn='{$sn}'"; //die($sql);
$xoopsDB->queryF($sql) or redirect_header($_SERVER['PHP_SELF'], 3, web_error());
#----單圖上傳
$subdir = "prod"; //子目錄(前後不要有 / )
$ugmUpFiles = new ugmUpFiles($module_name, $subdir); //實體化
$col_name = "prod";
$ugmUpFiles->set_col($col_name, $sn);
$ugmUpFiles->del_files();
#商品型錄
$col_name = "prodPdf";
$ugmUpFiles->set_col($col_name, $sn);
$ugmUpFiles->del_files();
}
```
2.