12345678910111213141516171819202122232425262728293031323334 |
- <?php
- require_once("../../php/db_utils.php");
-
- try {
- // Connect to the database
- $database = db_connect();
-
- // Incoming data
- $canvasId = $_POST["canvas_id"];
-
- // Declare query
- $query = 'SELECT canvas.user_id
- FROM collaborators
- INNER JOIN canvas
- ON canvas.canvas_id = collaborators.canvas_id
- AND canvas.canvas_id = "' . $canvasId . '" LIMIT 1;';
-
- // Run query
- $recordSet = db_query_return($database, $query);
-
- $record = mysqli_fetch_assoc($recordSet);
-
- mysqli_free_result($recordSet);
-
- echo($record["user_id"]);
-
- // Close the connection to the database
- db_close($database);
- }
- catch(Exception $e) {
- $errorMsg = $e->getMessage();
- print_r($errorMsg);
- }
- ?>
|