/**
* @name: escapeString
* @desc: escapes special characters to prepare a string for SQL query insertion
* @param: $fugitiveString - the string that needs to be escaped
*/
function escapeString($fugitiveString) {
// Use "real" function if we have a new enough version, otherwise use the depricated function
if(function_exists('mysql_real_escape_string')) {
$fugitiveString = mysql_real_escape_string($fugitiveString, $this->conn);
} else {
$fugitiveString = mysql_escape_string($fugitiveString);
}
return $fugitiveString;
}
I added the check for mysql_real_escape_string because I wasn’t sure if we are supporting PHP versions prior to 4.3. I didn’t see any minimum requirements on the site anywhere.