Getting rid of Slashes \

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
itspram
Forum Newbie
Posts: 8
Joined: Tue Sep 16, 2003 6:26 am

Getting rid of Slashes \

Post by itspram »

Hi Experts all...

As per testing rules I need to use
1"\45|!,')0 1"\45|!,')0 1"\45|!,')0 1"\45|!,')(50)
as an input value. it inserts properly in mysql.

but when I try to edit it it shows me "\\" instead of "\"
and If I refresh the pages it mupltiplies....

Please suggest what to do....
stripslashes isnt work for me coz. I need to insert slashes in the database..


thanks in advance
qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

Post by qads »

Code: Select all

$block_of_text = stripslashes($block_of_text);
:D ..check it out at php.net for more information..
User avatar
AVATAr
Forum Regular
Posts: 524
Joined: Tue Jul 16, 2002 4:19 pm
Location: Uruguay -- Montevideo
Contact:

Post by AVATAr »

dont us strip_slashes before you insert in the DB.. use stripslashes when you output the fields for editing (when you echo those in the form fields).
qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

Post by qads »

dam that was fast avatar lol
User avatar
AVATAr
Forum Regular
Posts: 524
Joined: Tue Jul 16, 2002 4:19 pm
Location: Uruguay -- Montevideo
Contact:

Post by AVATAr »

YEAHHH!!!!
itspram
Forum Newbie
Posts: 8
Joined: Tue Sep 16, 2003 6:26 am

Post by itspram »

thanks Guys,

but problem is not yet solved.
if I will output with stripslash it will remove all slashes originally I have.
I need them in my table as it is.

and if I will use addslashes on update it will again multiply slashes to orginals ...

any other options ?
evilMind
Forum Contributor
Posts: 145
Joined: Fri Sep 19, 2003 10:09 am
Location: Earth

Post by evilMind »

might try using stripcslashes() but that'll probably have the same results that stripslashes has... or you could reg em' out.
ereg_replace('\','',$removeSlashesString);
-or-
ereg_replace("\\",'',$removeSlashesString);
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

itspram
Forum Newbie
Posts: 8
Joined: Tue Sep 16, 2003 6:26 am

Post by itspram »

Thanks all of you...
you all are great people here...

A special thanks to McGruff, a Moderator..

issue resolved....

hope will come up with new issue for all of you...

Prams
Post Reply