if your using objects... you can pass this function an object and it
looks for the "name" property in an object and fixes the ticks to go
into the db... http://axelscript.com <http://axelscript.com>  or
http://reynacho.net <http://reynacho.net>  < Jake Churchill wrote the
function, but didnt write about it... i'm posting a blog enty on it on
tuesday morning... but it pretty much just has this function in it...

/**
* this escapes single ticks so they can be stored in the DB correctly
**/
public function escapeStrings( value:Object ):Object
{
// get object details
var objectDescription:XML = flash.utils.describeType(value);
// get object properties as XMLList
var objectProperties:XMLList = new XMLList(objectDescription.accessor);
// create a new object to store modified data in
var newVal:Object = new Object();

// loop over all properties
for( var x:uint = 0; x < objectProperties.length(); x++ )
{
// if the property is a string, escape single ticks
if( [EMAIL PROTECTED] == "String" )
{
[EMAIL PROTECTED] =
String([EMAIL PROTECTED]).replace('\'','\'\'');
}
// otherwise just grab the value of the property as it is
else
{
[EMAIL PROTECTED] =
[EMAIL PROTECTED];
}
}

// return new value
return newVal;
}


Reply via email to