I have created an API to handle data requests from a MySQL database. The API is implemented in PHP.
I currently have a problem where I have a select query A and it returns a json object to the api caller:
<pre>
$queryA = "SELECT ...";
$queryB = "SELECT ...";
$a = array();
if(mysqli_num_rows($queryAResult))
{
while($row = mysqli_fetch_assoc($queryAResult))
{
$a_a = $row["A"];
$name = $row["name"];
$arr = array('a' => $a_A, 'name' => $name);
$a[] = array('a'=> $arr);
}
header('Content-type: application/json');
echo $_GET['jsoncallback'] . '(' . json_encode(array('a'=>$a)) . ');';
}
</pre>
How do I json_encode and return 2 arrays please?
Simply using an array of array
What’s your problem with that ?