2

How I can do the same as in the script below using a loop?

$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}%'

Thanks.

Short Tuto
  • 59
  • 1
  • 8

0 Answers0