我如何使用循环执行与下面脚本相同的操作?
$res = mysql_query("SELECT * FROM {$table_1} WHERE txn_id LIKE '%{$txn_id}%'
UNION
SELECT * FROM {$table_2} WHERE txn_id LIKE '%{$txn_id}%'
UNION
SELECT * FROM {$table_3} WHERE txn_id LIKE '%{$txn_id}%'
UNION
SELECT * FROM {$table_4} WHERE txn_id LIKE '%{$txn_id}%'
UNION
SELECT * FROM {$table_5} WHERE txn_id LIKE '%{$txn_id}%'

感谢。