-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdelete_script5.php
More file actions
27 lines (23 loc) · 879 Bytes
/
delete_script5.php
File metadata and controls
27 lines (23 loc) · 879 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
// Assume you have established a database connection in your connection.php file
require 'connection.php';
// Get the file ID from the URL
$fileId = isset($_GET['id']) ? $_GET['id'] : null;
// Validate the file ID (you should perform more validation as needed)
if ($fileId !== null) {
// Perform the deletion in the database
$deleteQuery = "DELETE FROM faculty WHERE id = $fileId";
if ($conn->query($deleteQuery) === TRUE) {
// Return a success message (this will be sent back to the AJAX request)
echo "File deleted successfully";
} else {
// Return an error message (this will be sent back to the AJAX request)
echo "Error deleting file: " . $conn->error;
}
} else {
// Return an error message if the file ID is not provided
echo "File ID not provided";
}
// Close the database connection
$conn->close();
?>