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

 counting and comparing db values

Print topic Send  topic

Author Message
Cleopatra

Posts: 73
Posted: 05/03/2010, 6:28 AM

Hi all,
I've a grid and I'm trying to count and compare the record value from the database for one id and placing it in a label.
Using the following custom code in the before show event:
//-----------------------------------------
$db = new clsDBOracle();
if($res1 = CCDLookUp("count(*)","messagein","msg=".$Container->msg->GetValue()=='A',$db))
$Container->Label1->SetValue($res1);
else {
$Container->Label1->SetValue(0);
}
$db->close();
//-----------------------------------------
I think the compare part is where something is not right, because I'm getting the total number of records and not all of them have msg value= A

any Ideas on what to do in order to get the correct result?

_________________
php newbie
View profile  Send private message
ckroon

Posts: 869
Posted: 05/03/2010, 10:56 AM

I am by no means an expert but I think you have to declare $res1 first.. then do the IF statement.
I am just guessing with this.. but this is how I would do it.

$db = new clsDBOracle();
$get =$Container->msg->GetValue();
$res1 = CCDLookUp ("count(*)","messagein","msg=" ??? // not sure what you need here// .',$db;

if ($get <=$res1)//not sure how you want to compare them

$Container->Label1->SetValue($res1);
else {
$Container->Label1->SetValue(0);
}
$db->close();
_________________
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.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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