示例#1
0
     }
     break;
 case 'editSubCategory':
     # code...
     $category = new MainCategory();
     $category->type = $_POST['typeMain'];
     $result = $category->getIdCategory();
     $subCategory = new SubCategory();
     $subCategory->category_id = $result['id'];
     $subCategory->type = $_POST['typeSub'];
     $result = $subCategory->getSubCatId();
     if ($result['id'] != 0) {
         //found
         $subCategory->id = $result['id'];
         $subCategory->type = $_POST['typeSubNew'];
         echo $subCategory->updateSubCategory();
         echo "Data updated";
     }
     break;
 case 'removeSubCategory':
     # code...
     $category = new MainCategory();
     $category->type = $_POST['typeMain'];
     $result = $category->getIdCategory();
     $subCategory = new SubCategory();
     $subCategory->category_id = $result['id'];
     $subCategory->type = $_POST['typeSub'];
     $result = $subCategory->getSubCatId();
     if ($result['id'] != 0) {
         //found
         $subCategory->id = $result['id'];