ok
Direktori : /home2/selectio/public_html/tnpsctestbatch.com/admin/apis/backups/ |
Current File : /home2/selectio/public_html/tnpsctestbatch.com/admin/apis/backups/projects.php |
<?php ob_start(); session_start(); include "../config/config.php"; $session_id = $_SESSION['hrm']['id']; if(isset($_POST['type']) && $_POST['type']=='project_add'){ error_log("Running"); try{ $name = $_POST['project_name']; $timing = $_POST['project_timing']; $description = $_POST['project_description']; $statement = $pdo->prepare("INSERT INTO `tbl_projects`(`name`, `description`, `project_timing`) VALUES (?,?,?)"); $result = $statement->execute(array($name, $description, $timing)); if($result){ $return_arr['message']='Project Added Successfully...'; $return_arr['status']=200; } else{ $return_arr['message']='Something Went Wrong..'; $return_arr['status']=400; } }catch(PDOException $e){ $return_arr['message']="$e"; $return_arr['status']=500; } echo json_encode($return_arr); } if(isset($_POST['type']) && $_POST['type']=='projects_update'){ error_log("Running"); try{ $name = $_POST['project_name']; $timing = $_POST['project_timing']; $description = $_POST['project_description']; $status = $_POST['status']; $ids = $_POST['ids']; $statement = $pdo->prepare("UPDATE `tbl_projects` SET `name`=?, `description`=?, `project_timing`=?, `status`=? WHERE id=?"); $result = $statement->execute(array($name, $description, $timing, $status, $ids)); error_log("UPDATE `tbl_projects` SET `name`='$name', `description`='$description', `project_timing`='$timing', `status`='$status' WHERE id='$ids'"); if($result){ $return_arr['message']='Project Updated Successfully...'; $return_arr['status']=200; } else{ $return_arr['message']='Something Went Wrong..'; $return_arr['status']=400; } }catch(PDOException $e){ $return_arr['message']="$e"; $return_arr['status']=500; } echo json_encode($return_arr); } ?>