I have a query that is sent to my SQL database from PHP. It looks something like this:
$result = mysql_query("SELECT ...");
while($r = mysql_fetch_assoc($result)) {
$rows[] = $r;
}
print json_encode($rows);
I ultimately return the json_encoded result to my Java application (Android, actually) so that I can pick apart the pieces and put them into a nice Java object.
I have come to a point where I need some more data to come from this query, and I don't know how to get it. Is there a way for me to give myself the results of ANOTHER query, and inject it into this json_encoded result? Like basically run another query, and append it to the $r
on each iteration of the loop and have it "seem" as if it was another column returned from the original queries select
? I just don't know how to handle this $rows[]
array.
Let me know if my question is not clear.