RE: [PHP-WIN] Matching arrays to build tables
| From: | HKG) | Date: | Mon, 29 Sep 2003 10:55:59 +0000 |
| Subject: | RE: [PHP-WIN] Matching arrays to build tables | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-21598@lists.php.net to get a copy of this message | ||
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: [PHP-WIN] 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