What are the potential pitfalls of using the * wildcard in a SELECT query in PHP?

Using the * wildcard in a SELECT query in PHP can potentially return more data than needed, leading to performance issues and unnecessary data transfer. It is recommended to explicitly specify the columns needed in the SELECT query to avoid these pitfalls.

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

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