What potential security risks are associated with using SELECT * in SQL queries in PHP scripts?

Using SELECT * in SQL queries can expose sensitive information and lead to potential security risks such as SQL injection attacks. It is recommended to explicitly specify the columns to retrieve in the SELECT statement to minimize the risk of exposing unintended data.

// Specify the columns to retrieve in the SELECT statement instead of using SELECT *
$query = "SELECT column1, column2, column3 FROM table_name WHERE condition = :condition";
$stmt = $pdo->prepare($query);
$stmt->bindParam(':condition', $condition_value);
$stmt->execute();