title: Help merge 2 arrays and sort by key
body: <p>I am having some trouble with a basic php issue and want to know if anyone can help me out.  Basically I need to combine the results of 2 queries, and merge the arrays based on the key, while retaining the 1 key to 1 value that is present in both queries.  </p>
  
  <p>For example:  "select * from table 1, table 2 where table1.id = table2.id"... make an array of this.</p>
  
  <p>Then:  "select * from table3, table4 where table3.id2 = table4.id2" .. make another array.  </p>
  
  <p>Finally:  While ($res) { print out each line with }.</p>
  
  <p>Any ideas on how to handle this?  Pseudo code greatly appreciated.  The relationship betwee the ids is that table1.id = table3.id but the other ids are just to join between the tables as presented in the queries.</p>