File: /home/imensosw/www/imenso.co/demo/resume-maker/ajax-delete-cv.php
<?php
require('include/initalizedb.php');
session_start();
$resumeID = $_POST['resumeId'];
$table = "cv_user_resumes";
$where = array(
'id' => $resumeID,
'user_id' => $_SESSION['session_id']
);
$where2 = array(
'resume_id' => $resumeID,
'user_id' => $_SESSION['session_id']
);
if(isset($_SESSION['session_id']) && !empty($_SESSION['session_id']) && !empty($resumeID)){
$res = $db->removeData('cv_user_resumes', $where);
if($res){
//Removing Experience Starts
$db->removeData("cv_user_resumes_expirience", $where2);
//Removing Experience Ends
//Removing Education Starts
$db->removeData("cv_user_resumes_education", $where2);
//Removing Education Ends
//Removing Education Starts
$db->removeData("cv_user_resumes_languages", $where2);
//Removing Education Ends
//Removing Achievement Starts
$db->removeData("cv_user_resumes_achievements", $where2);
//Removing Achievement Ends
//Removing Projects Starts
$db->removeData("cv_user_resumes_projects",$where2);
//Removing Projects Ends
//unlink('profile-image/'.$_SESSION['session_id'].'/'.$resumeID);
$response['type'] = 'success';
$response['message'] = 'Resume deleted successfully';
} else {
$response['type'] = 'Failed';
$response['message'] = 'Resume deletion failed 1';
}
}
else {
$response['type'] = 'Failed';
$response['message'] = 'Resume deletion failed 2';
}
print json_encode($response);