iam making a json object by the following query
$arr = array();
$qs=qq("select main_cat_id,main_cat_name,id,name,cat_id,cat_id_main from main,scheme where main_cat_name='xyz' and cat_id_main=main_cat_id");
while($obj = mysql_fetch_object($qs))
{
$arr[] = $obj;
}
$total=sizeof($arr);
$jsn_obj='{"scheme":'.json_encode($arr).',"totalrow":"'.$total.'"}';
// this is a mock example
Now iam having another query
Query 2:
$q=qq("select main_cat_id,main_cat_name,id,name,cat_id,cat_id_main from main,scheme where main_cat_name='xyz' and cat_id_main=main_cat_id order by scheme_1_year DESC");
while($r=mysql_fetch_array($q))
{
$cats_id=$r['cat_id'];
if($cats_id!=0)
{
$qw=qq("select cat_name from category where cat_id='$cats_id'"); // Query 3
$rw=mysql_fetch_array($qw);
$catm_name=$rw['cat_name'];
}
}
// this is a mock example
both are doing the same thing but the later is calculating some cats name as well.This category table cant be merged with the earlier two tables so i have to calculate this cat_name with another query.
Now i want a json object that should be having all the entries of Query 2 and respective Query 3 result. sumthing like this (if explained in simple words): query 2 result[0] plus query 3 result[0],query 2 result[1] plus query 3 result[1]
How can i club these two results together in a json object. Plz guide!!