Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

2 Queries into an array 1

Status
Not open for further replies.

likelylad

IS-IT--Management
Joined
Jul 4, 2002
Messages
388
Location
GB
I have a PHP page that runs 2 separate queries from 2 separate tables. The queries could be produce the following.

Query1 Query2
========= =========
Month|Entered Month|Returned
Jan 20 Jan 2
Feb 50 Feb 4
Mar 100 Mar 34
Apr 24

Please note that 1 query may produce a month that is not in the other


What I would like to do is put this into a multi-dimentional array to output the following table on screen

Month Entered Returned
Jan 20 2
Feb 50 4
Mar 100 34
Apr 24


Thankin in advance for any help received
 
Suggestion (??? whatever SQL/DB you use):

Query1 -> $result:
while ($row = ???_fetch_array($result)){
$month[$row[Month]][Entered] = $row[Entered];
}

Query2 -> $result:
while ($row = ???_fetch_array($result)){
$month[$row[Month]][Returned] = $row[Returned];
}

This will result in a hash that keyed by the month and has values combined from both queries.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top