Forum Moderators: coopster

Message Too Old, No Replies

Can't get str replace to work

         

andrewsmd

5:04 pm on Dec 22, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This works fine on my dev server

$replace = str_replace("\\'", "'", $row['text']);

I'm trying to replace any occurences of \' (which have been escaped in the mysql database) with '.

It works great on my dev server which is win 7 ultimate. However when I go to production win2k8 r2 pointed to a mysql database on a win2k3 server it doesn't replace anything. The only thing I can think of is that the ' character on the mysql server, which is older, is different than the ' character on the new server where php is hosted. Any ideas around this?

Matthew1980

5:35 pm on Dec 22, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi there andrewsmd,

Pardon me being stupid, which has been me most of today, but isn't that the point of stripslashes() ?

Cheers,
MRb

andrewsmd

5:52 pm on Dec 22, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



HAHAHAHAHA! I didn't know that function existed. Who's the stupid one now :).

Matthew1980

6:38 pm on Dec 22, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi there andrewsmd,

At least your functional now :)

When you have used some functions that are there for exactly that reason, you assume that people already know about it when they are doing database driven projects, and as that is virtually 100% of my work & personal stuff, you kinda take it for granted that other people know about it, and where to use it..

Have fun with the rest of your project anyway.

Cheers,
MRb

elf_red

12:49 am on Dec 23, 2010 (gmt 0)

10+ Year Member



>on a win2k3 server it doesn't replace anything

It is because magic_quotes is on on win2k3.