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 |
 |
 |
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. |
 |
 |
|