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

 RESOLVED: Syntax problems

Print topic Send  topic

Author Message
ckroon

Posts: 869
Posted: 09/03/2008, 10:36 AM

I have this on the Label's before show event ( Label is 'max1', grid is 'cst_1')

global $DBConnection1;  
$cst_1->max1->SetValue(CCDLookUp( 'ela_total_n', 'aplan_clusters_ela', 'ela_cluster_no=1 . 'AND ela_cluster_grade =' . CCGetFromGet ("gl",""), $DBConnection1));

I am getting an unexpected = sign error.

Anyone see the error?
_________________
Walter Kempees...you are dearly missed.
View profile  Send private message
DonP
Posted: 09/03/2008, 10:53 AM

Your code has a single-quote missing after ela_cluster_no=1. Also adding
a space before the AND might help since it may be trying to use
"ela_cluster_no=1AND" or better still remove the concatenation all
together between the two since it's not needed:

global $DBConnection1;  
$cst_1->max1->SetValue(CCDLookUp( 'ela_total_n', 'aplan_clusters_ela',   
'ela_cluster_no=1 AND ela_cluster_grade =' . CCGetFromGet   
("gl",""),$DBConnection1));

Don (DonP)

ckroon wrote:
> I have this on the Label's before show event ( Label is 'max1', grid is
> 'cst_1')
>
>
global $DBConnection1;  
> $cst_1->max1->SetValue(CCDLookUp( 'ela_total_n', 'aplan_clusters_ela',  
> 'ela_cluster_no=1 . 'AND ela_cluster_grade =' . CCGetFromGet ("gl",""),  
> $DBConnection1));
>
> I am getting an unexpected = sign error.
>
> Anyone see the error?
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>
ckroon

Posts: 869
Posted: 09/03/2008, 1:41 PM

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

Posts: 869
Posted: 09/03/2008, 1:45 PM

Hmm.. but what if I needed to add another URL in the string?

$cst_1->max1->SetValue(CCDLookUp( 'math_total_n', 'aplan_clusters_math','math_cluster_no=1 AND math_cluster_grade =' . CCGetFromGet("gl","")AND 'aplan_math_test = ' CCGetFromGet("test",""),$DBConnection1));


:-D
_________________
Walter Kempees...you are dearly missed.
View profile  Send private message
DonP
Posted: 09/03/2008, 2:28 PM

If you needed to add other dynamic items to the AND clause, then of
course they would need to be concatenated but don't concatenate where
it's not needed, being sure to enclose any text in quotes (I generally
use regular quotes myself, mainly because they are easier to see) and to
have a space before any ANDs or ORs so that they do not become one with
the value.

$cst_1->max1->SetValue(CCDLookUp( 'math_total_n',   
'aplan_clusters_math', 'math_cluster_no=1 AND math_cluster_grade =' .   
CCGetFromGet("gl","") . ' AND aplan_math_test = ' .   
CCGetFromGet("test",""),$DBConnection1));

The example above will work only if the dynamic values are numeric. If
text, then the quotes will need a little extra work, something like this:

$cst_1->max1->SetValue(CCDLookUp("math_total_n",   
"aplan_clusters_math", "math_cluster_no=1 AND math_cluster_grade ='" .   
CCGetFromGet("gl","") ."'" . " AND aplan_math_test = '" .   
CCGetFromGet("test","") . "'",$DBConnection1));


Don (DonP)

ckroon wrote:
> Hmm.. but what if I needed to add another URL in the string?
>
>
$cst_1->max1->SetValue(CCDLookUp( 'math_total_n',  
> 'aplan_clusters_math','math_cluster_no=1 AND math_cluster_grade =' .  
> CCGetFromGet("gl","")AND 'aplan_math_test = '  
> CCGetFromGet("test",""),$DBConnection1));

>
> :-D
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>
datadoit
Posted: 09/03/2008, 2:32 PM

$db = new clsDBConnection1();
$cts_1->max1->SetValue(CCDLookUp('math_total_n', 'aplan_clusters_math',
'math_cluster_no=1 AND math_cluster_grade=' .
$db->ToSQL(CCGetFromGet('gl',''), ccsText) . ' AND aplan_math_test=' .
$db->ToSQL(CCGetFromGet('test',''), ccsText), $db));

Let the ToSQL() determine how to handle text, integers, NULLS, etc.
DonP
Posted: 09/03/2008, 2:50 PM

I've found the CCS has me so spoiled with all its built-in functions
that I am forgetting "real" PHP and SQL so I try to keep their use to a
minimum unless it truly makes things easier. In this case, I do not
believe it does but that's just my opinion.

Don (DonP)

datadoit wrote:
> $db = new clsDBConnection1();
> $cts_1->max1->SetValue(CCDLookUp('math_total_n', 'aplan_clusters_math',
> 'math_cluster_no=1 AND math_cluster_grade=' .
> $db->ToSQL(CCGetFromGet('gl',''), ccsText) . ' AND aplan_math_test=' .
> $db->ToSQL(CCGetFromGet('test',''), ccsText), $db));
>
> Let the ToSQL() determine how to handle text, integers, NULLS, etc.

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.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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