예제 #1
0
 public function postFramework()
 {
     // check database connections
     $conn = $this->databaseConnection();
     if ($conn) {
         $id = trim($_POST['ID']);
         $birthDate = trim($_POST['BirthDate']);
         $firstName = trim($_POST['FirstName']);
         $lastName = trim($_POST['LastName']);
         $gender = trim($_POST['Gender']);
         $hireDate = trim($_POST['HireDate']);
         $queries = new Queries();
         $sqlCheck = $queries->checkFrameworkIfExistsById($id);
         $checkResult = mysqli_query($conn, $sqlCheck);
         if (mysqli_num_rows($checkResult) > 0) {
             echo json_encode(array('error' => $id . ' already Exists.'));
         } else {
             $sqlQuery = $queries->newFrameworkAddition($id, $birthDate, $firstName, $lastName, $gender, $hireDate);
             $result = mysqli_query($conn, $sqlQuery);
             if ($result) {
                 echo json_encode(array('success' => 'Created New Entry.'));
             } else {
                 echo json_encode(array('error' => 'Unable to Add Request.'));
             }
         }
     } else {
         $connection = false;
         echo "There was an error, please contact web administrator.";
         return false;
     }
 }
 public function postFramework()
 {
     // check database connections
     $conn = $this->databaseConnection();
     if ($conn) {
         $framework = trim($_POST['framework']);
         $language = trim($_POST['language']);
         $link = trim($_POST['link']);
         $description = trim($_POST['description']);
         $queries = new Queries();
         $sqlCheck = $queries->checkFrameworkIfExists($framework);
         $checkResult = mysqli_query($conn, $sqlCheck);
         if (mysqli_num_rows($checkResult) > 0) {
             echo json_encode(array('error' => $framework . ' already Exists.'));
         } else {
             $sqlQuery = $queries->newFrameworkAddition($framework, $language, $link, $description);
             $result = mysqli_query($conn, $sqlQuery);
             if ($result) {
                 echo json_encode(array('success' => 'Created Framework Entry.'));
             } else {
                 echo json_encode(array('error' => 'Unable to Add Request.'));
             }
         }
     } else {
         $connection = false;
         echo "There was an error, please contact web administrator.";
         return false;
     }
 }