CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Total database fields

Print topic Send  topic

Author Message
ckroon

Posts: 869
Posted: 01/11/2008, 9:07 AM

Hi All.

I can get a the sum of labels in a grid, but I am not sure how to go about getting Sum values directly from the database.
Mysql.

On a grid I have a label that needs to display the running total of donations (field:gift_amt) for a certain donation pledge(field:PID).

So it would be Sum of field:'amt' in table 'pledges' where PID = "pledgeid"//the URL

Any pointers.. samples I can gander at?



_________________
Walter Kempees...you are dearly missed.
View profile  Send private message
datadoit
Posted: 01/11/2008, 9:18 AM

SQL:
SELECT SUM(amt) AS Amount FROM pledges WHERE PID='{pledgeid}'

or

CCS:
global $YourConnection;
$db = new clsDBYourConnection();
$Component->SetValue(CCDLookUp("SUM(Amt)","pledges","PID='".CCGetParam("pledgeid","")."'",$db));
$db->close();
ckroon

Posts: 869
Posted: 01/11/2008, 9:28 AM

global $awesomeness
$datadoit = super $awesomeness();

:-D
_________________
Walter Kempees...you are dearly missed.
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.