On Sun, 7 Nov 2004 03:52:28 -0800 (PST), Stuart Felenstein
<[EMAIL PROTECTED]> wrote:

> I asked a question yesterday about this but I think my
> question is now more fine tuned:
> 
> Right now I have about 50+ session variables that will
> be inserted into my mysql database in a transaction.
> I need to do the mysql_real_escape_string and because
> magic_quotes_gpc is turned on stripslashes as well.
> 
> I'm wondering if there is a way to use a function or
> class within my connection script to take care of all
> of this ? As oppposed to listing everyone out ?  I
> know I can pass all the variables as an array but some
> of the variabls are arrays themselves, so not sure how
> that would work.
> 
In the manual http://es2.php.net/manual/en/function.get-magic-quotes-gpc.php
you have an example just for that. Take a look to the Example 2.

The way I do it, is using that function, but think the example in the
manual is much better:

function array_deslash(&$array) {
        
        foreach ($array as $key => $value) {
                if (is_string($value)) {
                        $array[$key] = stripslashes($value);
                } elseif (is_array($value)) {
                        array_deslash($arrau[$key]);
                }
        }
}

Hope this helps,
Jordi.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to