In the provided PHP code, how can the query be modified to only select male users with the privilege of "user"?

To modify the query to only select male users with the privilege of "user", you can add a WHERE clause to filter the results based on the gender and privilege columns. You can use the AND operator to combine the conditions for gender and privilege. The query should specify that gender is 'male' and privilege is 'user'.

$query = "SELECT * FROM users WHERE gender = 'male' AND privilege = 'user'";
$result = mysqli_query($connection, $query);

// Fetch the data from the result set
while ($row = mysqli_fetch_assoc($result)) {
    // Process the data
}