Results 1 to 9 of 9
-
30th May 2011, 11:48 AM #1OPMember
Php replacing characters !
hi my database has text with characters like this : "%28" , "%29"
i guess they are coming instead of the curly braces : "(" , ")"
i just want to filter these things out.
"str_replace" function is not working for this characters.
can somebody give me an alternate method in doing this ???
thanks.softleaks Reviewed by softleaks on . Php replacing characters ! hi my database has text with characters like this : "%28" , "%29" i guess they are coming instead of the curly braces : "(" , ")" i just want to filter these things out. "str_replace" function is not working for this characters. can somebody give me an alternate method in doing this ??? Rating: 5
-
30th May 2011, 12:28 PM #2Retired NinJaWebsite's:
loledhard.commajor problem here is, i cant understand what u want. Otherwise str_replace works fine if u need to replace some text
You don't hate Justin bieber.You hate the fact you ain't Justin Bieber!
-
30th May 2011, 12:32 PM #3OPMember
i tried with str_replace. It is not working.
this is my code :
$a="%282009%29";
str_replace("%28","",$a);
-
30th May 2011, 12:33 PM #4MemberWebsite's:
LulzCovers.com LulzTroll.comif you are fetching the data from the database and its coming like %28 , %29
you can use htmlspecialchars_decode
more: http://www.php.net/manual/en/functio...ars-decode.php
or try using the strip_tagsContact me for Traffic, SEO, WCDDL, Wordpress, IPB related Services or queries.
Template Designing, PSD to HTML, Wordpress
-
30th May 2011, 12:36 PM #5Retired NinJaWebsite's:
loledhard.com
-
30th May 2011, 12:41 PM #6OPMember
@humour
i tried that too.
nothing happened.
@deAthbLisS
i tried the htmlspecialchars and it is not working.
trying strip_tags now....
-
30th May 2011, 12:53 PM #7Retired NinJaWebsite's:
loledhard.comi guess u forgot to assign the value of replace function back to variable
$a="%282009%29";
$a=str_replace("%28","",$a);
?
You don't hate Justin bieber.You hate the fact you ain't Justin Bieber!
-
30th May 2011, 02:33 PM #8(╯?□?)╯︵ ┻━┻Website's:
Xenu.ws WarezLinkers.com SerialSurf.com CracksDirect.comYeah its not working because str_replace returns, it doesn't change by reference.
you need to assign it to a variable.
Also see urldecode().Projects:
WCDDL - The Professional DDL Script
Top Secret Project: In Development - ZOMG
ImgTrack - Never Have Dead Images Again!
-
30th May 2011, 02:42 PM #9Member
^agree with JmZ. need urldecode() but if you want to use str_replace for them (if you're fussy) use this:
$str = "%29 lolcat %28";
echo str_replace(array("%29","%28"), array("\)","\("), $str);
should do the trick.
Made by Envee :P
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
[VPS] VPS for replacing my Kimsufi 2G dedicated
By HD-addict in forum ArchiveReplies: 2Last Post: 14th May 2012, 01:01 PM -
PHP Curl post with non-english characters
By t3od0r in forum Web Development AreaReplies: 14Last Post: 2nd Mar 2012, 11:19 PM -
Help in replacing lines in various files
By Funny in forum General DiscussionReplies: 9Last Post: 19th Nov 2011, 08:16 PM -
Japanese Characters for Wi-Fi
By bxflow in forum General DiscussionReplies: 5Last Post: 12th Jan 2011, 01:23 AM -
Weird Characters MySQL
By CyberJ37 in forum Server ManagementReplies: 4Last Post: 5th May 2009, 07:47 PM
themaPoster - post to forums and...
Version 5.35 released. Open older version (or...