How can using "Select * from..." instead of specific table columns impact the performance of a PHP script?

Using "Select * from..." can impact the performance of a PHP script because it retrieves all columns from the table, even if they are not needed. This can lead to unnecessary data transfer and processing, slowing down the script. To improve performance, it is recommended to specify only the required columns in the SELECT statement.

// Specify only the required columns in the SELECT statement
$sql = "SELECT column1, column2, column3 FROM table_name WHERE condition";
$result = mysqli_query($conn, $sql);

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