What are the potential pitfalls of using aliases in PHP when querying multiple tables?

When using aliases in PHP when querying multiple tables, one potential pitfall is the risk of ambiguity or confusion when referencing columns with the same name in different tables. To avoid this issue, it is important to use unique aliases for each table and to prefix column names with the table alias when referencing them in the query.

$query = "SELECT t1.id AS t1_id, t2.id AS t2_id
          FROM table1 t1
          JOIN table2 t2 ON t1.id = t2.id";