What is the potential issue with using "SELECT *" in PHP database queries?

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

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

if (mysqli_num_rows($result) > 0) {
    while($row = mysqli_fetch_assoc($result)) {
        // Process the query result
    }
} else {
    echo "0 results";
}