What are the potential issues with using SELECT * in SQL queries when querying multiple tables in PHP?

Using SELECT * in SQL queries when querying multiple tables in PHP can lead to performance issues and unnecessary data retrieval. It is recommended to explicitly specify the columns needed in the SELECT statement to improve query efficiency and reduce the chance of returning redundant or sensitive data.

<?php
// Specify the columns needed in the SELECT statement instead of using SELECT *
$query = "SELECT table1.column1, table2.column2 FROM table1 JOIN table2 ON table1.id = table2.id";
$result = mysqli_query($connection, $query);

// Process the query result as needed
?>