Re: string functions and manipulations in php As like addcslashes there is another string function available called addslashes().
It returns a string with backslashes before characters that need to be quoted in database queries etc. These characters are single quote ('), double quote ("), backslash (\) and NUL (the NULL byte).
For Example: <?php
$str = "Is your name O'reilly?";
// Outputs: Is your name O\'reilly?
echo addslashes($str);
?>
Another Example <?php
$str = "Who's Kai Jim?";
echo $str . " This is not safe in a database query.<br />";
echo addslashes($str) . " This is safe in a database query.";
?>
Ouput:
Who's Kai Jim? This is not safe in a database query.
Who\'s Kai Jim? This is safe in a database query.
Thanks
__________________ K K Venkata Charya Success is easy to get but difficult to retain |