RE: Matching arrays to build tables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Would something like

SELECT day, SUM(amount) AS amount_sum, DISTINCT(code) AS code
FROM <some tables>
WHERE <some conditions are true>
GROUP BY day,amount _sum, Code

be usefull for you? Or do you already do this?

-----Original Message-----
From: Mike Quinn
To: php-windows@lists.php.net
Sent: 29-9-2003 6:30
Subject:  Matching arrays to build tables

Hi,

I have 3 dynamic arrays which is related data pulled from a mySQL
database,
the first being day $days[],second being amount $amount[] and third
being a
specific code $code[]. What I need to do is display a table with 1 to 15
in
the left hand column (days) but where the array $days[] contains an item
I
need to add a column with the related data but add the values of amount
if
there are two entries for a given day, something like the below.

$days[] = ('2', '2', '5');
$amount[] = ('150', '100', '90');
$code[] = ('LAC', 'LAC', 'NCA');

+++++++++++++
Day |Amt. | Code |
 1    |  0     |           |
 2    |  250 | LAC  |
 3    |  90   | NCA |
 4    |  0     |           |

etc. until 15!

Any help would be greatly appreciated my code is getting jumbled and
confusing :(.

Thanks

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux