$servername = 'localhost'; $dbname = 'directory'; $dBUsername = '******'; $dBPassword = ''; $dbConn = new DBHandler("mysql:host={$servername};dbname={$dbname}", $dBUsername, $dBPassword); $dbConn->connect(); for ($i = 0; $i < $_GET['count']; $i++) { $butName = "remove" . $i; $rowName = "table" . $i; $inputName = "social" . $i; $row = unserialize($_GET[$rowName]); if (isset($_GET[$butName])) { echo "found remove"; $command = "DELETE FROM Social_Network WHERE UserID = :userID AND Link = :link AND Name = :name"; $params = array(":name" => $row['Name'], ":link" => $row['Link'], ":userID" => $row['UserID']); $dbConn->executeWithoutReturn($command, $params); header('Location: edit.php?userID=' . $_SESSION['id']); } } for ($i = 0; $i < $_GET['countT']; $i++) { $butName = "removeT" . $i; $rowName = "tableT" . $i; $inputName = "team" . $i; $row = unserialize($_GET[$rowName]); if (isset($_GET[$butName])) { echo "found remove"; $command = "DELETE FROM Membership WHERE Username = :userID AND Team_Name = :tname"; $params = array(":tname" => $row['Team_Name'], ":userID" => $_SESSION['id']); $dbConn->executeWithoutReturn($command, $params); header('Location: edit.php?userID=' . $_SESSION['id']); }