What are the drawbacks of using SELECT * in SQL queries, and how can specifying column names improve code robustness?

Using SELECT * in SQL queries can lead to performance issues, as it retrieves all columns from a table even if only a few are needed. Additionally, it can make the code less robust and prone to errors when the table structure changes. By specifying column names in the query, you can improve code readability, maintainability, and performance.

// Specify column names in the SQL query instead of using SELECT *
$sql = "SELECT column1, column2, column3 FROM table_name WHERE condition = 'value'";
$result = mysqli_query($connection, $sql);

// Fetch data from the result set
while ($row = mysqli_fetch_assoc($result)) {
    // Process the data
}