Delete function using PHP Prepare statement using MySQL
function deleteBreaking($id)
{
ini_set('display_errors',1);
ini_set('display_startup_errors', 1);
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$stmt = $this->conn->stmt_init();
if ($stmt->prepare("delete from breaking_news where id=?"))
{
$stmt->bind_param("i",$id);
$stmt->execute() or die("<h1>Error</h1>".mysqli_error($this->conn));
$stmt->close();
return "<span class='g-successMsg'>Breaking News Deleted Successfully</span>";;
}
else
{
return "<span class='errorMsg'>Oops ! Error in Deleting breaking news, Please try again later</span>";
}
}