Reputation: 1911
I have a php script that has three queries that are each returning a set of results.
Now i want to combine the results from the three queries into a single JSON array.
Anyone knows how to achieve this?
The queries can't be joined.
Thanks.
Upvotes: 3
Views: 1188
Reputation: 2987
You might want to look into array_merge()
.
A simple example:
<?php
$result = array_merge($array_result_of_query1, $array_result_of_query2, $array_result_of_query3);
echo json_encode($result);
?>
Upvotes: 6