Add an extra column
select 1 as FromTable
UNION
select 2 as FromTable;
Anything from the second select will have 2
as $row["FromTable"]
You also NEED to read about SQL injections, and use the mysqli APIs instead ideally (?
saves both parsing time, escaping time and the need to escape!)