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

 CCToSQL with ccsInteger returns float

Print topic Send  topic

Author Message
Bart00

Posts: 8
Posted: 03/08/2010, 11:46 PM

Today I tried to check if an array key exists:

  
$id = CCToSQL(CCGetFromGet('id'), ccsInteger);  
if (array_key_exists($id, $testArray)) {  
  // do smth.  
}  

This code doesn't work, because array_key_exists expects either an int or a string, instead CCToSQL returns a float.

Can this be changed? Suggestion:

  
function CCToSQL($Value, $ValueType) {  
  if(!strlen($Value)) {  
    return "NULL";  
  }  
  else {  
    if($ValueType == ccsInteger) {  
      return intval($Value);  
    }  
    else if ($ValueType == ccsFloat) {  
      return doubleval(str_replace(",", ".", $Value));  
    }  
    else {  
      return "'" . str_replace("'", "''", $Value) . "'";  
    }  
  }  
}  
View profile  Send private message
datadoit
Posted: 03/09/2010, 5:53 AM

Second!

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.