Correct on the brackets - but not on the results still working... The code I had in the email was just a sample - here is the real code...
$res=mysql_query("select distinct dealercode from transactions order by dealercode",$intranet); $transactions=Array(); while($row=mysql_fetch_array($res)) { $amt=mysql_query("select sum(amount) as total from transactions where date between '2003-04-01' and '2003-06-31' and dealercode='$row[dealercode]'",$intranet); $afftotal=mysql_fetch_array($amt); array_push($transactions,$row[dealercode]=>Array("onlineu",$afftotal[total]) ); $amt=mysql_query("select usercountry,sum(amount) as total from orders_placed where date between '2003-04-01' and '2003-06-31' and dealercode='$row[dealercode]' and sent='y' group by usercountry",$intranet); while($cdtotal=mysql_fetch_array($amt)) { array_push($transactions[$row[dealercode]],$cdtotal[usercountry]=>$cdtotal[t otal]); } } And as for your offline suggestion of putting it into one query - I did try that first of course, but due to the large amount of data, and the shoddy nature of the database design (inherited not built) the query times out. This atleast returns within 1 min with the data when I can retrieve it :) Ideally the database would have one table with all the transaction information in it, and when I redesign it will, but in the meantime I am stuck with this... On 8/28/03 9:09 PM, "David Otton" <[EMAIL PROTECTED]> wrote: > On Thu, 28 Aug 2003 18:14:39 -0400, you wrote: > >> While($row=mysql_fetch_array($res) { > >> That *should* create the array above, but as I mentioned array_push does not >> seem to be taking the keys.... I just get a Parse error message for the >> line. (the first array_push) > > Ahem. Count the brackets? :) > > (On a style point, your code would be easier to read for bugs like this if > you added some whitespace.) -- Cheers Mike Morton **************************************************** * * Tel: 905-465-1263 * Email: [EMAIL PROTECTED] * **************************************************** "Indeed, it would not be an exaggeration to describe the history of the computer industry for the past decade as a massive effort to keep up with Apple." - Byte Magazine Given infinite time, 100 monkeys could type out the complete works of Shakespeare. Win 98 source code? Eight monkeys, five minutes. -- NullGrey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php