What is the best practice for creating links for each headline in a news archive using PHP and SQL?

When creating links for each headline in a news archive using PHP and SQL, it is best to create a dynamic URL that includes a unique identifier for each news article. This unique identifier can be the article's ID from the database. By using this approach, you can easily retrieve the specific article when the link is clicked.

// Assuming $row is the result of a SQL query fetching the news articles
while($row = $result->fetch_assoc()) {
    $article_id = $row['id'];
    $headline = $row['headline'];
    $url = "article.php?id=$article_id";
    
    echo "<a href='$url'>$headline</a><br>";
}