check-public.php 786 B

1234567891011121314151617181920212223242526272829
  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. // Check if the tag already exists
  9. $query = 'SELECT canvas_public FROM canvas WHERE canvas_id = "' . $canvasId . '";';
  10. $recordSet = db_query_return($database, $query);
  11. $record = mysqli_fetch_assoc($recordSet);
  12. $public = $record["canvas_public"];
  13. mysqli_free_result($recordSet);
  14. echo($public);
  15. // Close the connection to the database
  16. db_close($database);
  17. }
  18. catch(Exception $e) {
  19. $errorMsg = $e->getMessage();
  20. print_r($errorMsg);
  21. }
  22. ?>