How can the lack of proper spacing in SQL queries affect the execution and results in PHP?

Improper spacing in SQL queries can lead to syntax errors and incorrect results when executed in PHP. To avoid this issue, always ensure proper spacing between keywords, table names, column names, and values in your SQL queries.

$query = "SELECT * FROM users WHERE username = 'john_doe'";