OIGweb
|
Posted: 11/17/2003, 6:47 AM |
|
I have a column age that takes a persons birthday and converts it to the persons age. I need to find the average of all the ages. I tried the CDDLookUp function as pointed out in the tips and articles but that is for .asp and I cannot seem to get it to work in .php. Any ideas would be appreciated.
This is the code just to get the sum, which does not work.
//DLookup @69-3D654DBA
global $DBConnection1;
global $HR_EMP;
$result = CCDLookUp(SUM(Age), TABLE1, "", $DBConnection1);
$result = intval($result);
$HR_EMP->avg->SetValue($result);
//End DLookup
Thanks
|
|
|
DaveRexel
|
Posted: 11/17/2003, 9:55 AM |
|
::
While they do not directly address your problem the tutorials in this category may help you.
http://www.rexdesign.com/ccs/kb.php?language_id=7&category_id=42
Hope this helps
Greetings
Dave
RexDesign CodeCharge Studio Tutorials http://www.rexdesign.com/ccs/default.php
|
|
|
Steve Kitchen
|
Posted: 11/17/2003, 3:04 PM |
|
If you code your query as
$result = CCDLookUp('SUM(Age) AS Age', TABLE1, "", $DBConnection1);
you should get the result you expect. I came across the same problem & solved it this way ...
Rgds,
Kitch
|
|
|
|