File "question_delete.php"
Full Path: /home/ccipcixf/public_html/hirepro/admin/question_delete.php
File size: 949 bytes
MIME-type: text/x-php
Charset: utf-8
<?php
// Check if the user ID is set in the URL
if (!isset($_GET["id"])) {
// Redirect or handle the case when the user ID is not provided
// For example, you might want to show an error message or redirect to another page
header("Location: show_junior_questions.php");
exit();
}
// Get the user ID from the URL
$user_id = $_GET["id"];
require "config.php";
// Use prepared statement to prevent SQL injection
$query = "DELETE FROM `questions_junior` WHERE `question_id`= ?";
$stmt = mysqli_prepare($conn, $query);
if ($stmt) {
// Bind the parameters
mysqli_stmt_bind_param($stmt, "i", $user_id);
// Execute the statement
mysqli_stmt_execute($stmt);
// Close the statement
mysqli_stmt_close($stmt);
}
// Close the database connection
mysqli_close($conn);
// Redirect to the page showing junior questions
header("Location: show_junior_questions.php");
exit();
?>