ok
Direktori : /home2/selectio/public_html/subamangala/admin/api/ |
Current File : /home2/selectio/public_html/subamangala/admin/api/delete.php |
<?php include "../config/config.php"; // Bulk Special Dates Here if($_POST['type']=="bulk_special_dates_delete"){ $delete_id = implode(',', $_POST['assign_id']); $statement = $pdo->prepare("DELETE FROM `tbl_special_dates` WHERE id in (".$delete_id.");"); $result=$statement->execute(); if($result==1) { $message='Success..'; $error='1'; } else { $message='Failed..'; $error='0'; } $datas[] = array('message' => $message, 'error' => $error); echo $message; } // caste delete api starts here if($_POST['type']=="biness_to_bine"){ $delete_id =$_POST['delete_id']; if(isset($delete_id)){ $statement1 = $pdo->prepare("SELECT * FROM profiles where caste=$delete_id LIMIT 1"); $statement1->execute(); $emp_data1 = $statement1->fetchAll(PDO::FETCH_ASSOC); $totalData1 = $statement1->rowCount(); if($totalData1==1){ $return_arr['message'] = 'This caste Is Register On The Profiles So this Is Not Delete Access'; $return_arr['status']=200; } else{ $statement = $pdo->prepare("UPDATE ".$_POST['table']." SET status_type=? WHERE id=?"); $result=$statement->execute(array(0,$_POST['delete_id'])); if($result==1) { $return_arr['message'] = 'Success'; $return_arr['status']=200; } else { $return_arr['message']="Something went wrong try again..."; $return_arr['status']=400; } } echo json_encode($return_arr); } } // caste delete api ends here // Soft Delete Here if($_POST['type']=="soft_delete"){ error_log("UPDATE ".$_POST['table_name']." SET status=0 WHERE id=".$_POST['delete_id']); $statement = $pdo->prepare("UPDATE ".$_POST['table_name']." SET status=? WHERE id=?"); $result=$statement->execute(array(0,$_POST['delete_id'])); if($result==1) { $message='Success..'; $error='1'; } else { $message='Failed..'; $error='0'; } $datas[] = array('message' => $message, 'error' => $error); echo $message; } // Luggage Tickets Here if($_POST['type']=="delete_luggage"){ $statement = $pdo->prepare("DELETE FROM `tbl_luggage` WHERE id=?"); $result=$statement->execute(array($_POST['delete_id'])); if($result==1) { $message='Success..'; $error='1'; } else { $message='Failed..'; $error='0'; } $datas[] = array('message' => $message, 'error' => $error); echo $message; } if($_POST['type']=="dynamic_in_active"){ $statement = $pdo->prepare("UPDATE ".$_POST['table']." SET status=? WHERE id=?"); $result=$statement->execute(array(0,$_POST['delete_id'])); if($result==1) { $message='Success..'; $error='1'; } else { $message='Failed..'; $error='0'; } $datas[] = array('message' => $message, 'error' => $error); echo $message; } if($_POST['type']=="dynamic_active"){ $statement = $pdo->prepare("UPDATE ".$_POST['table']." SET status=? WHERE id=?"); $result=$statement->execute(array(1,$_POST['delete_id'])); if($result==1) { $message='Success..'; $error='1'; } else { $message='Failed..'; $error='0'; } $datas[] = array('message' => $message, 'error' => $error); echo $message; } if($_POST['type']=="user_delete"){ $statement = $pdo->prepare("UPDATE tbl_user SET status=? WHERE id=?"); $result=$statement->execute(array(0,$_POST['delete_id'])); if($result==1) { $message='Success..'; $error='1'; } else { $message='Failed..'; $error='0'; } $datas[] = array('message' => $message, 'error' => $error); echo $message; } if($_POST['type']=="profiles_delete"){ $statement = $pdo->prepare("UPDATE `profiles` SET delete_status=? WHERE id=?"); $result=$statement->execute(array(0,$_POST['delete_id'])); if($result==1) { error_log("profiles_delete enter"); $message='Success..'; $error='1'; } else { $message='Failed..'; $error='0'; } $datas[] = array('message' => $message, 'error' => $error); echo $message; } if($_POST['type']=="dynamic_delete"){ $statement = $pdo->prepare("UPDATE ".$_POST['table']." SET status=? WHERE id=?"); $result=$statement->execute(array(0,$_POST['delete_id'])); if($result==1) { $message='Success..'; $error='1'; } else { $message='Failed..'; $error='0'; } $datas[] = array('message' => $message, 'error' => $error); echo $message; } if($_POST['type']=="dynamic_active"){ $statement = $pdo->prepare("UPDATE ".$_POST['table']." SET status=? WHERE id=?"); $result=$statement->execute(array(1,$_POST['delete_id'])); if($result==1) { $message='Success..'; $error='1'; } else { $message='Failed..'; $error='0'; } $datas[] = array('message' => $message, 'error' => $error); echo $message; } if($_POST['type']=="hard_delete"){ $id=$_POST['delete_id']; $statement = $pdo->prepare("delete from ".$_POST['table']." WHERE id=$id"); $result=$statement->execute(); if($result==1) { $message='Success..'; $error='1'; } else { $message='Failed..'; $error='0'; } $datas[] = array('message' => $message, 'error' => $error); echo $message; } ?>