The queries merge ok and results are correct except I get a notice: "Notice: Use of undefined constant UNION - assumed 'UNION' in...."
But is UNION a constant or is the context wrong?
$query = $query1." ".UNION." ".$query2;
$result = mysqli_query($dbcon, $query) or die('Error getting data');
$num_rows = mysqli_num_rows($result);