Need spot of code for array merge

  • Follow


I want to do a select on the database and read the results in to an array.

No problem

 I want to do another select on the database (different fields but using
field alias) and read that into a second array.

I want to then add the rows in the second array to the first array so I
have one large array.

Or maybe I could I could just put the results of the second select into the
first array?

array_merge will not work as it will overlay duplicate string keys.

Here is sample data:

array1:
sport=>baseball
sport=>foobtall

array2:
sport=>swimming
sport=>track

end result:
sport=>baseball
sport=>foobtall
sport=>swimming
sport=>track

Anyone have some magic? It will save me the "expense" of doing a temp
table.

Thanks,
Al


0
Reply atakeoutcanton1 (26) 8/6/2003 2:39:33 AM

Adams-Blake Co. wrote:

> 
> I want to do a select on the database and read the results in to an array.
> 
> No problem
> 
>  I want to do another select on the database (different fields but using
> field alias) and read that into a second array.
> 
> I want to then add the rows in the second array to the first array so I
> have one large array.
> 
> Or maybe I could I could just put the results of the second select into the
> first array?
> 
Ooops. Sorry, wrong group. It was meant to the PHP group which is just above 
this one in my news reader's list of groups.

-Al



> array_merge will not work as it will overlay duplicate string keys.
> 
> Here is sample data:
> 
> array1:
> sport=>baseball
> sport=>foobtall
> 
> array2:
> sport=>swimming
> sport=>track
> 
> end result:
> sport=>baseball
> sport=>foobtall
> sport=>swimming
> sport=>track
> 
> Anyone have some magic? It will save me the "expense" of doing a temp
> table.
> 
> Thanks,
> Al

0
Reply atakeoutcanton1 (26) 8/6/2003 2:43:38 AM


1 Replies
62 Views

(page loaded in 0.042 seconds)


Reply: