Re: SQL in the database..little help please
| From: | Ryan A | Date: | Wed, 10 Mar 2004 01:39:40 +0000 |
| Subject: | Re: SQL in the database..little help please | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-179966@lists.php.net to get a copy of this message | ||
> Hello Ryan,
>
> Wednesday, March 10, 2004, 1:24:04 AM, you wrote:
>
> RA> I have first put off magic_quotes...now can anybody tell me how
> RA> YOU are doing it so I can do it the same damn exact way...reading
> RA> online is a problem coz I am getting conflicting ways of doing
> RA> it....or am just braindead looking at code all day, either
> RA> way..your answer is appreciated.
>
> There are a few ways to do it. The following code will check to see if
> magic quotes are enabled on the server you are using and if they are,
> it'll turn them off. So you can safely use "addslashes" in your code.
>
> You could swap the 1 and the 0 to have the reverse effect - i.e. if
> it's
> turned off, enable it and then
> don't have "addslashes" anywhere.
>
> I see no reason why either method won't
> be as portable as the other so
> long as you are consistent.
>
> <?php
> if (get_magic_quotes_runtime() == 1)
> {
> set_magic_quotes_runtime(0);
> }
> ?>
Hi Richard,
Thanks for replying.
Yep, I got the above...but should I (or do I) need to use a stripslashes
when reading from the DB?
Thanks,
-Ryan