nstruth2

save.php Code

Jan 15th, 2024
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.46 KB | Source Code | 0 0
  1. <?php
  2.     include 'database.php';
  3.     $category=trim($_POST['category']);
  4.     $description=trim($_POST['description']);
  5. $SQLStatement = $con->prepare("INSERT INTO `PC_Components`( `category`, `description`) VALUES (?,?)");
  6. $SQLStatement->bind_param("ss", $category, $description);
  7. $rc = $SQLStatement->execute();
  8.     if (true===$rc) {
  9.         echo json_encode(array("statusCode"=>200));
  10.     }
  11.     else {
  12.         echo json_encode(array("statusCode"=>201));
  13.     }
  14.       //connection closed.
  15. ?>
Advertisement
Add Comment
Please, Sign In to add comment