What is the potential issue with using SELECT * in PHP code?

Using SELECT * in PHP code can lead to potential issues such as fetching unnecessary data, decreased performance due to retrieving more data than needed, and potential security risks if sensitive information is included in the query result. To solve this issue, it is recommended to explicitly specify the columns to fetch in the SELECT statement instead of using SELECT *.

// Specify the columns to fetch in the SELECT statement instead of using SELECT *
$query = "SELECT column1, column2, column3 FROM table_name WHERE condition = 'value'";
$result = mysqli_query($connection, $query);

// Use the fetched data
if(mysqli_num_rows($result) > 0) {
    while($row = mysqli_fetch_assoc($result)) {
        // Process the data here
    }
}