News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

MySQL Single Quotes

Started by ZJRT, June 13, 2006, 07:11:09 PM

Previous topic - Next topic

ZJRT

My web host, in its infinite wisdom, decided to disable the ability to use escaped single quotes in any MySQL query. So, anything like this:


INSERT into TEST(test) VALUES('What\'s this?');


wouldn't work. So, is there any way to get around this? The prospect of reprogramming every database query to use the


'


code instead of the escaped single quote is more than a little daunting. Any help here would be greatly appreciated.


H

Although I'm not a wiz with SQL are you just replacing \ with ' ?

If so then you can just use a batch find and replace
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

kegobeer

You should only have to edit one thing: the db_query function.  You could scan the input string for ' and for \' and replace them with '.  Unfortunately, that could also cause problems with some queries that might need the '.  Hopefully a dev can comment on my suggestion.
"The truth of the matter is that you always know the right thing to do. The hard part is doing it." - Norman Schwarzkopf
Posting and you (Click "WATCH THIS MOVIE")

Advertisement: