123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- require_once("../../php/db_utils.php");
- try {
- // Connect to the database
- $database = db_connect();
-
- // Incoming data
- $canvasId = $_POST["canvas_id"];
- $ideaId = $_POST["idea_id"];
-
- // Declare query
- $query = 'SELECT id
- FROM comments
- WHERE canvas_id = "' . $canvasId . '"
- AND idea_id = "' . $ideaId . '";';
-
- // Run query
- $recordSet = db_query_return($database, $query);
-
- // Get comments by active user
- $comments = Array();
-
- while($record = $recordSet->fetch_assoc()) {
- $comments[] = $record["id"];
- }
-
- mysqli_free_result($recordSet);
-
- echo(json_encode($comments));
-
- // Close the connection to the database
- db_close($database);
- }
- catch(Exception $e) {
- $errorMsg = $e->getMessage();
- print_r($errorMsg);
- }
- ?>
|