RE: addslashes ()
| From: | Jason Murray | Date: | Sat, 14 Oct 2000 11:58:45 +0000 |
| Subject: | RE: addslashes () | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-20141@lists.php.net to get a copy of this message | ||
(Apologies to all listed recipients)
Senthil, if you have a PHP problem please send it *only* to the list.
We're not all here to be your personal PHP bugfixer.
> i have a problem . i want to add slashes to my string
> $a = senthil ...i want it like 'senthil'
>
> i did $a=addslashes($a);
> but nothing worked ..
> 1.i have magic quotes = off..
> 2.is there a way to print ' and " --
<?
$a = "senthil";
$a = addslashes($a);
echo $a;
?>
This code will always produce "senthil" as an output. addslashes()
will have no effect because there's no need to add slashes to it.
If you want to output "'senthil'", then just add the quote to it:
<?
$a = "'senthil'";
$a = addslashes($a);
echo $a;
?>
This will output "\'senthil\'".
Please refrain from sending PHP problems via personal mail in future.
Jason
--
Jason Murray
jasonm@melbourneit.com.au
Web Design Team, Melbourne IT
Don't believe everything you're foretold.