What are the best practices for creating links to database entries in PHP, such as using $_GET variables and unique IDs?

When creating links to database entries in PHP, it is best practice to use unique IDs as parameters in the URL to retrieve the specific entry. This can be achieved by using $_GET variables to pass the ID from the link to the PHP script that fetches the data from the database.

// Link to database entry with unique ID
<a href="view_entry.php?id=123">View Entry</a>

// PHP script to retrieve entry based on ID
$id = $_GET['id'];

// Query database using the ID to fetch the specific entry
$query = "SELECT * FROM entries WHERE id = $id";
$result = mysqli_query($connection, $query);
$row = mysqli_fetch_assoc($result);

// Display the entry details
echo "Title: " . $row['title'];
echo "Content: " . $row['content'];