<?php include('../../config/setup.php');?>

<?php




// create
    // if(isset($_POST['quality_add'])){

    //     $title = $_POST['quality_title'];
    //     $addsugcatephoto=$_FILES['quality_img']['name'];
    //     $addsubphoto="../../../img/quality/".$addsugcatephoto;
    //     move_uploaded_file($_FILES["quality_img"]["tmp_name"],$addsubphoto);
    //     $maincate=date('Y-m-d');
    //     $addsubcate=mysqli_query($config,"INSERT INTO quality_master(quality_title,quality_img)
    //                                     VALUES('$title','$addsugcatephoto')");	
    //     if($addsubcate==false)
    //     {
            
    //         echo "<script>window.location.href='../quality.php?erro=0';</script>".mysqli_error();	 
    //     }
    //     else{
            
    //         echo "<script>window.location.href='../quality.php';</script>";	 

            
    //     }	

    // }

// update content
    // if(isset($_POST['quality_pro']))
    //     {  $qid = $_POST['quality_id'];
    //         $title = $_POST['quality_title'];
    //     $sql = "UPDATE quality_master SET quality_title = '$title' WHERE quality_id = '$qid' ";

    //     if($config->query($sql) == false)
    //     {
    //     echo mysqli_error();	 
    //     }
    //     else{
            
    //         echo "<script>window.location.href='../quality.php?msg=100';</script>";	 
            
    //     }

    // }

// update image
    // if(isset($_POST['quality_image'])){

    //     $qid = $_POST['quality_id'];
    //     $subimage=$_FILES['quality_img']['name'];
    //     $subcatephoto="../../../img/quality/".$subimage;
    //     move_uploaded_file($_FILES["quality_img"]["tmp_name"],$subcatephoto);
    //     $imageediton=date('Y-m-d'); 
    //     $sql = "UPDATE quality_master SET quality_img='$subimage' WHERE quality_id = '$qid' ";

    //     $update_service_photo=mysqli_query($config,$sql);
    //     if($update_service_photo==false)
    //     {
    //     echo "<script>window.location.href='../quality.php?erro=0';</script>".mysqli_error();	 
    //     }
    //     else{
    //         echo "<script>window.location.href='../quality.php?msg=100';</script>";	 
    //     }

    // }

// delete
//     if($_GET['delprocat']==700){
//         $qid = $_GET['delid'];
//         $promo_delete=mysqli_query($config,"delete from quality_master where quality_id='$qid'");
//         if($promo_delete==false)
//         {
//         echo "<script>window.location.href='../quality.php?erro=0';</script>".mysqli_error();	 
//         }
//         else{
            
//             echo "<script>window.location.href='../quality.php?delmsg=101';</script>";	 
//         }
// }


// quality

if(isset($_POST['quality_img_edit'])){
    $id = $_POST['img_quality_id'];
    $qualityimage = $_FILES['quality_image']['name'];
    $qualityphoto="../../../img/quality/".$qualityimage;
    move_uploaded_file($_FILES["quality_image"]["tmp_name"],$qualityphoto);
    $imageediton=date('Y-m-d'); 
    $sql="UPDATE quality_master SET quality_img ='$qualityimage' WHERE quality_id= '$id' ";
    $update_quality_photo=mysqli_query($config,$sql);
    if($update_quality_photo==false)
    {
        echo  "<script>window.location.href='../quality.php?erro=0';</script>".mysqli_error($update_quality);	 
    }
    else{
        echo  "<script>window.location.href='../quality.php?mes=0';</script>";	   
    }
}


if(isset($_POST['quality_edit'])){ 
    $sql = "UPDATE quality_master SET quality_title='".$_POST['quality_title']."' , quality_desc='".$_POST['quality_desc']."' WHERE quality_id='".$_POST['Edit_quality_id']."'";
    $update_about=mysqli_query($config,$sql);
    if($update_about==false) {
        echo  "<script>window.location.href='../quality.php?erro=0';</script>".mysqli_error($update_quality);	 
    }else{
        echo  "<script>window.location.href='../quality.php?mes=0';</script>";	 	
    }
}


?>