How can the MySQL function 'UPDATE' be utilized for managing news updates in PHP?

To manage news updates in PHP using the MySQL function 'UPDATE', you can create a form where users can input the news they want to update. This form will submit the data to a PHP script that will execute an SQL query using the 'UPDATE' function to update the news in the database.

<?php
// Assuming you have already established a connection to the database

if(isset($_POST['submit'])){
    $news_id = $_POST['news_id'];
    $new_news = $_POST['new_news'];

    $sql = "UPDATE news SET news_content='$new_news' WHERE news_id=$news_id";

    if(mysqli_query($conn, $sql)){
        echo "News updated successfully";
    } else{
        echo "Error updating news: " . mysqli_error($conn);
    }
}
?>

<form method="post">
    <input type="text" name="news_id" placeholder="News ID">
    <textarea name="new_news" placeholder="Enter updated news"></textarea>
    <input type="submit" name="submit" value="Update News">
</form>