In what situations is it considered bad practice to use "SELECT * FROM" in SQL queries, and what are the potential drawbacks?

Using "SELECT * FROM" in SQL queries is considered bad practice when you only need specific columns from a table because it retrieves all columns, potentially impacting performance and wasting resources. To avoid this, explicitly specify the columns you need in the SELECT statement.

$query = "SELECT column1, column2, column3 FROM table_name WHERE condition = 'value'";
$result = mysqli_query($connection, $query);

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