View Full Version : Resolved stripslashes is there a happy medium

09-15-2011, 12:14 AM
hi im having a booger of a time here, i have just about tried everything i know so i thought i would ask.

the situation is i need to escape my text before the insert but when i do it adds slashes,

like this ( isn\\\'t)

so i use stripslashes which solves that problem fine.

but it also strips out the slashes from \r\n and im left with rn.

i have played around with replace and also nl2br before i use the stripslashes so it does not mess up the returns.

how do i do the stripslashes but keep those in the \r\n from being messed with.


09-15-2011, 12:19 AM
magic_quotes_gpc does not addslashes to the runtime of \r\n. It only adds to ', ", \, and \0. \r and \n are single chars, so they will not be escaped as they do not match the above list.
So you are using the stripslashes incorrectly. This should occur before the mysql_real_escape_string or whatever database you are using equivalent is called.

09-15-2011, 12:31 AM
you are the person with the silver cigar . thanks i had it so backwards wow. it seemed logical but i was way off. thanks so much

09-15-2011, 12:33 AM
Yep you betcha.
Fortunately magic_quotes_gpc / runtime will be gone very very soon :]