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); } ?>