Created
June 27, 2022 06:16
-
-
Save msisaifu/835fc4ca9beefe239df729bba50c86d6 to your computer and use it in GitHub Desktop.
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
<?php | |
$servername = "localhost"; | |
$username = "root"; | |
$password = ""; | |
$dbname = "students"; | |
$table_name = 'student_info'; | |
$inserted = false; | |
$something_wrong = false; | |
$id = $_GET['id']; | |
$rows = null; | |
// Create connection | |
$conn = mysqli_connect($servername, $username, $password, $dbname); | |
// Check connection | |
if (!$conn) { | |
die("Connection failed: " . mysqli_connect_error()); | |
} | |
$sql = "DELETE FROM {$table_name} WHERE id='{$id}'"; | |
if (mysqli_query($conn, $sql)) { | |
header("Location: index.php"); | |
} else { | |
header("Location: index.php"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment