I am trying to combine 2 db results together to have an array like the following:
array(
0=>array(
'name'=>'John',
'title'=>'manager',
'email'=>'test',
'permission'=>'1',
'depart'=>'human resource'
),
1=>array(
'name'=>'Ted',
'title'=>'employee',
'email'=>'test2',
'permission'=>'2',
'depart'=>'human resource'
)
)
The first 3 elements are from 1 returned DB result and the last two elements are from another DB results.
$firstResults = DBCall::call(getName); //get name,title,email or John and Ted as an array
$secondResults = DBCall::call(getPermission); //get permission and depart as an array
//I then use array merge
$userResults=array_merge($firstResults ,$secondResults);
//but it will become
array(
0=>array(
'name'=>'John',
'title'=>'manager',
'email'=>'test'
),
1=>array(
'name'=>'Ted',
'title'=>'employee',
'email'=>'test2'
),
2=>array(
'permission'=>'1',
'depart'=>'human resource'
),
3=>array(
'permission'=>'2',
'depart'=>'human resource'
)
)
Are there anyways to archieve the outcome I need? Thanks a lot!