-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from TEAM-7-SAD/SPD-65
Spd 65
- Loading branch information
Showing
3 changed files
with
275 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
// Include the database connection file | ||
require_once 'includes/db-connector.php'; | ||
// Check if account IDs are provided | ||
if (isset($_POST['saleIds']) && is_array($_POST['saleIds'])) { | ||
// Get the account IDs from the POST data | ||
$saleIds = $_POST['saleIds']; | ||
|
||
// Prepare and execute the SQL query to delete selected accounts | ||
$sql = "DELETE FROM user WHERE id IN (" . implode(',', array_fill(0, count($saleIds), '?')) . ")"; | ||
$sql = "DELETE FROM transaction WHERE id IN (" . implode(',', array_fill(0, count($saleIds), '?')) . ")"; | ||
$stmt = $db->prepare($sql); | ||
$types = str_repeat('i', count($saleIds)); | ||
$stmt->bind_param($types, ...$saleIds); | ||
if ($stmt->execute()) { | ||
// If the deletion is successful, return a success response | ||
echo 'success'; | ||
} else { | ||
// If an error occurs, return an error response | ||
echo 'error'; | ||
} | ||
} else { | ||
// If account IDs are not provided, return an error response | ||
echo 'error'; | ||
} | ||
?> |
Oops, something went wrong.