What role does the DISTINCT keyword play in PHP when dealing with multiple data entries?

When dealing with multiple data entries in PHP, the DISTINCT keyword is used in SQL queries to eliminate duplicate rows from the result set. This is helpful when you want to retrieve unique values from a database table without any repetition.

// Query to select distinct values from a database table
$query = "SELECT DISTINCT column_name FROM table_name";
$result = mysqli_query($connection, $query);

// Loop through the results and display the unique values
while($row = mysqli_fetch_assoc($result)) {
    echo $row['column_name'] . "<br>";
}