update-project-in-database.php 777 B

1234567891011121314151617181920212223242526
  1. <?php
  2. require_once("../../php/db_utils.php");
  3. try {
  4. // Connect to the database
  5. $database = db_connect();
  6. // Incoming data
  7. $canvasId = $_POST["canvas_id"];
  8. $projectTitle = $_POST["project_title"];
  9. $projectDate = $_POST["current_date"];
  10. // Update project title
  11. $query = 'UPDATE canvas SET canvas_name="' . $projectTitle . '", canvas_date="' . $projectDate . '" WHERE canvas_id="' . $canvasId . '";';
  12. // Update old project title
  13. db_query_no_return($database, $query);
  14. // Close the connection to the database
  15. db_close($database);
  16. }
  17. catch(Exception $e) {
  18. $errorMsg = $e->getMessage();
  19. print_r($errorMsg);
  20. }
  21. ?>