Look - David - I do appreciate your efforts to help - and I realize that working blind on an email list is tough, but the question is not about the structure of the code, the database, reserved words or anything else.
The question for anyone out there is simple - does array_push allow you to push key=>value pairs? That is what is causing errors - nothing else, everything else is a result of inherited systems, and other developers crappy design. I agree with you David on all the issues that you bring up - date IS a reserved word - but it still works - that is the previous developers mentality anyhow :) > "$row[dealercode]" should be "$row['dealercode']", same goes for the other > dictionaries. Your code should be throwing a notice on that, which suggests > that your error-level is set low and you may be missing other problems. Fair if I was coding for anyting other than a one time report - I am not going to spend a great deal of time with 'proper' coding for a one time report that does not matter beyond it working once. > You want a structure like: > > array ( > 33 = array ( > 'a' = 52.00 > 'b' = 53.00 > 'c' = 54.00 > ) > 34 = array ( > 'a' = 55.00 > 'b' = 56.00 > 'c' = 57.00 > ) > ) yes > What's it supposed to look like when 33=>'a' exists more than once? Is that > possible? It does not 33=>a does not occur more than once. > That array_push looks like a mess. Try something like... > > $data = array(); > > for each row in query : > > $dealerid = $row[0]; > $data[$dealerid] = array(); > > for each subrow in subquery : > $country = $subrow[0]; > $amount = $subrow[1]; > > $data[$dealerid][$country] = $amount; This is what I am doing now, and yes it works, but this does not answer my original question. > Do you have a seperate dealer table? You're pulling "SELECT DISTINCT > dealercode FROM transactions", which is odd. Somewhere you may have a table > where dealername is associated with dealercode. That's what you should be > doing the join against. > > If I were you I'd ask on a database-specific mailing list, because it's > never faster to do it in software when you can push it all up into the > database instead. Thanks for the opinion - but I have tried it both ways. Software in this case is faster. 25 seconds execution in PHP, 3 mins in mysql. But this STILL does not answer the original question. -- 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