12345678910111213141516171819202122232425262728293031323334 |
- <?php
- require_once("../../php/db_utils.php");
-
- try {
- // Connect to the database
- $database = db_connect();
-
- // Incoming data
- $newTag = $_POST["tag"];
- $canvasId = $_POST["canvas_id"];
-
- // Declare query
- $query = 'SELECT tag FROM tags WHERE tag = "' . $newTag . '" AND canvas_id = "' . $canvasId . '";';
-
- // Run query
- $recordSet = db_query_return($database, $query);
-
- // Return the tag if it exists
- $record = mysqli_fetch_assoc($recordSet);
-
- $tag = $record["tag"];
-
- mysqli_free_result($recordSet);
-
- echo($tag);
-
- // Close the connection to the database
- db_close($database);
- }
- catch(Exception $e) {
- $errorMsg = $e->getMessage();
- print_r($errorMsg);
- }
- ?>
|