CodeCharge Studio
search Register Login  

Web Reports

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 [SOLVED] CCDLookUp Where clause text value

Print topic Send  topic

Author Message
frankthefixer

Posts: 52
Posted: 06/25/2010, 2:38 PM

Hello. I'm using a DLookUp to populate the value of one field based on another. The code works fine if the returned value in the 'Where' clause is a number, but not when it's text. The field is a serial number field which is a text field because they often contain alphanumerics.
I had:
$ccs_result = CCDLookUp("RecID", "RcvSerial", "Serial=".$Container->Serial->GetValue(),

i noticed after a while it only returned RecId's for serials that happend to be numerical, when a serial came over that had text it failed. I clumsily tried this:
$ccs_result = CCDLookUp("RecID", "RcvSerial", "Serial=".$Container->Serial->GetText(),

and single quoting it lke this:
$ccs_result = CCDLookUp("RecID", "RcvSerial", "Serial="'.$Container->Serial->GetValue()',

but to no avail- i'm no expert in php and did many searches for dlookup where clause and codecharge dlookup where but am stuck. i appreciate any help-
Thanks
View profile  Send private message
frankthefixer

Posts: 52
Posted: 06/25/2010, 7:30 PM

did it like this:

$ccs_result = CCDLookUp("RecID", "RcvSerial", "Serial=" .$db->ToSql($Container->Serial->GetValue(),ccsText)
View profile  Send private message
datadoit
Posted: 06/26/2010, 6:48 AM

That's the correct way to use DLookUp, via CCToSQL(), or just ToSQL().
Those functions basically determine whether single quotes are needed
around the condition.

Going forward, you should make a common practice of always using ToSQL()
in all of your custom coded conditions, as it also protects your
application from SQL injection attacks.
frankthefixer

Posts: 52
Posted: 06/26/2010, 9:38 AM

thanks for the tip datadoit
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.

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.