I try to display the data of two tables at the same time but that did not work for me.
<?php
require_once 'cont.php';
$resultAll = mysqli_query($con, "SELECT * FROM topic UNION SELECT * FROM Image ");
if ($resultAll) {
while($row[] = $resultAll->fetch_assoc()) {
$item = $row;
$json = json_encode($item, JSON_NUMERIC_CHECK);
}
} else {
$json = json_encode(["result" => "No Data Found"]);
}
echo $json;
$con->close();
?>
I get a message:
result" => "No Data Found
How can show two queries at one time? What error do I have in my code?