What are the potential pitfalls of using SELECT * in SQL queries in PHP?

Using SELECT * in SQL queries can lead to performance issues and potential security vulnerabilities. It's better to explicitly list the columns you need in the query to improve performance and reduce the risk of exposing sensitive data.

<?php
// Explicitly list the columns you need in the query
$query = "SELECT column1, column2, column3 FROM table_name";
$result = mysqli_query($connection, $query);

// Process the query result
while ($row = mysqli_fetch_assoc($result)) {
    // Handle the data
}
?>