Many thanks to both Michael and Bogdan.

Michael Sims wrote:

> Just curious, but why are you having to stripslashes() on the data coming
> out of the database?  Do you have magic_quotes_runtime enabled on your server?

I honestly don't know... all I know is that I'm adding slashes on the
way into the database, and stripping them on the way out, because
without them, I was getting errors / slashes everywhere.

It's a shared server at an ISP, so I don't have any real control.  i
seem to be having the same "problem" on my office test server too (where
I DO have control, but I'm keen to keep both environments as close to
the same as possible.

> This is untested, but should work:
> while($sql_myrow = mysql_fetch_array($sql_result)) {
>    foreach($sql_myrow as $key => $value) {
>      $$key=nl2br(stripslashes($value));
>    }
> }
> Basically the foreach loop goes through each index of $sql_myrow and
> creates a variable by that name, setting it equal to the value of the index
> after it's had it's slashes stripped and it's br's newlined. :-)

Looks good... shall test this afternoon... many many thanks!

> >Ultimately, I'd like to put this all into a function which I call that
> >does it all in one hit, but I'll take that in a smaller step :)
> The function Mr. Stancescu posted looks like it'll do the trick, with some
> modifications to perform the nl2br() and the stripslashes()...

Thanks again to both of you.

Justin French

PHP General Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to