When I run this query in mysql it returns all the requested results correctly:
SELECT row_id FROM table1 WHERE status = n
UNION ALL
SELECT row_id FROM table2 WHERE status = n
UNION ALL
SELECT row_id FROM table3 WHERE status = n
However when I run it from PHP it returns only one record, the first row that meets the requested condition.
$query = mysqli_query($link, "SELECT row_id FROM table1 WHERE status = n
UNION ALL
SELECT row_id FROM table2 WHERE status = n
UNION ALL
SELECT row_id FROM table3 WHERE status = n");
print_r(mysqli_fetch_array($query));
So print_r
shows the following: Array ( [0] => 1 [row_id] => 2580 )
, where 2580 is a id of the row from table1 that meets the requested condition.
How to make it return the full array of results?