In the provided PHP code, what improvements can be made to optimize the query performance and reduce the likelihood of duplicate results?

The issue in the provided PHP code is that it is not utilizing SQL DISTINCT keyword to eliminate duplicate results. By adding the DISTINCT keyword to the SQL query, we can ensure that only unique results are returned, optimizing query performance and reducing the likelihood of duplicate results.

// Original code
$query = "SELECT id, name FROM users WHERE age > 18";
$result = mysqli_query($conn, $query);

// Improved code with DISTINCT keyword
$query = "SELECT DISTINCT id, name FROM users WHERE age > 18";
$result = mysqli_query($conn, $query);