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

Using "SELECT *" in SQL queries in PHP can lead to potential drawbacks such as fetching unnecessary columns, which can impact performance by retrieving more data than needed. It can also make the code less maintainable as any changes to the table structure may affect the query results. To solve this issue, explicitly specify the columns to retrieve in the SELECT statement.

// Specify the columns to retrieve instead of using SELECT *
$sql = "SELECT column1, column2, column3 FROM table_name";
$result = mysqli_query($conn, $sql);

if (mysqli_num_rows($result) > 0) {
    // Process the query results
} else {
    echo "No results found";
}