$stmt->close(); // Delete all of the comments associated with the Discussion Topic $stmt = $mysqli->prepare("DELETE FROM replies WHERE discussionId = ?"); $stmt->bind_param('s', $_POST['deleteId']); $stmt->execute(); $stmt->close(); $msgBox = alertBox($discThreadDeletedMsg, "<i class='fa fa-check-square'></i>", "success"); } // Include Pagination Class include 'includes/getpagination.php'; $pages = new paginator($pagPages, 'p'); // Get the number of total records $rows = $mysqli->query("SELECT * FROM projectdiscus WHERE projectId = " . $projectId); $total = mysqli_num_rows($rows); // Pass the number of total records $pages->set_total($total); // Get Project Discussions $sql = "SELECT\n\t\t\t\tprojectdiscus.discussionId,\n\t\t\t\tprojectdiscus.projectId,\n\t\t\t\tprojectdiscus.adminId,\n\t\t\t\tprojectdiscus.clientId,\n\t\t\t\tprojectdiscus.discussionTitle,\n\t\t\t\tprojectdiscus.discussionText,\n\t\t\t\tDATE_FORMAT(projectdiscus.discussionDate,'%W, %M %e, %Y') AS discussionDate,\n\t\t\t\tUNIX_TIMESTAMP(projectdiscus.discussionDate) AS orderDate,\n\t\t\t\tDATE_FORMAT(projectdiscus.lastUpdated,'%W, %M %e, %Y') AS lastUpdated,\n\t\t\t\tCONCAT(clients.clientFirstName,' ',clients.clientLastName) AS theClient,\n\t\t\t\tCONCAT(admins.adminFirstName,' ',admins.adminLastName) AS theAdmin\n\t\t\tFROM\n\t\t\t\tprojectdiscus\n\t\t\t\tLEFT JOIN clients ON projectdiscus.clientId = clients.clientId\n\t\t\t\tLEFT JOIN admins ON projectdiscus.adminId = admins.adminId\n\t\t\tWHERE\n\t\t\t\tprojectdiscus.projectId = " . $projectId . "\n\t\t\tORDER BY orderDate " . $pages->get_limit(); $res = mysqli_query($mysqli, $sql) or die('-1' . mysqli_error()); // Only allow access to the Assigned Manager or Admins $qry = "SELECT\n\t\t\t\tassignedprojects.assignedTo,\n\t\t\t\tclientprojects.projectName\n\t\t\tFROM\n\t\t\t\tassignedprojects\n\t\t\t\tLEFT JOIN clientprojects ON assignedprojects.projectId = clientprojects.projectId\n\t\t\tWHERE assignedprojects.projectId = " . $projectId; $result = mysqli_query($mysqli, $qry) or die('-2' . mysqli_error()); $rows = mysqli_fetch_assoc($result); $assignedTo = $rows['assignedTo']; include 'includes/navigation.php'; if ($isAdmin != '1' && $rows['assignedTo'] != $adminId) { ?> <div class="content"> <h3><?php echo $accessErrorHeader; ?>