sanitize.php
/**
* Makes a string SQL-safe.
*
* @param string $string String to sanitize
* @param string $connection Database connection being used
* @return string SQL safe string
* @access public
* @static
*/
function escape($string, $connection = 'default') {
$db = ConnectionManager::getDataSource($connection);
$value = substr($db->value($string), 1);
$value = substr($value, 0, -1);
return $value;
}
if try at controler code:
$san = new Sanitize();
$var = $san->escape('12345');
die(var_dump($var));
take: string '234' (length=3)
WHY ?
if code:
$san = new Sanitize();
$var = $san->escape('1');
die(var_dump($var));
take: boolean false
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---