Please help me. I do not know what is the best way to data join these data with PHP code.
Here are my data.
ArrayA(array('id'=>'1','Date'=>'datehere'),array('id'=>'2','Date'=>'datehere'));
ArrayB(array('ArrayAId'=>'1','personal infos'=>'other data'),array('ArrayAId'=>'1','personal infos 2'=>'other data'),array('ArrayAId'=>'2','personal infos'=>'other data'),array('ArrayAId'=>'2','personal infos 2'=>'other data'));
I wanted to show all ArrayA items with their associate ArrayB Items as the following. 
ArrayA-item1 
ArrayB item1 with ArrayA-item1 Id 
ArrayB item2 with ArrayA-item1 Id
ArrayA-item2 
ArrayB item3 with ArrayA-item2 Id 
ArrayB item4 with ArrayA-item2 Id
The thing is ArrayB includes around 100 rows for each row from ArrayA. 
So when I tried to get 50 ArrayA Items, ArrayB got around 5000 rows. 
That is why I cannot use the following approach due to performance issue.
for(ArrayA)
{
     for(ArrayB){
          //Get all associate rows according to current ArrayA.
     }
}
The above code make my page dead because it have to loop 5000 rows for 50 times. So please help me and point to the correct direction to display all these data.
Thanks in advance. Kindly let me know if you need more details.
 
     
    