News:

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

Main Menu

Question on SQL + SMF2

Started by LakeXeno, June 08, 2012, 10:10:21 AM

Previous topic - Next topic

LakeXeno

Hey everyone, after converting from punbb to SMF2 now all my apostrophes ( ' ) have been escaped to look like: \'

Is there any SQL command I can possibly use? I have something like 18k topics to now skim over!!! :(

LOL. Any help would be greatly appreciated.

:o :P

Robert.

Hi, welcome to SMF! :)

I have moved your topic to the conversion board, just so you know. :)

Tony Reid

Well, you can use the word censor to swap it out, at least that way the users do not see it.

Alternatively,  you probably want to use replace...something like this


update TABLE set FIELD= replace(FIELD,"\'","'") where ID=1


table would probably be smf_messages and field would probably be something like body and id will be the message id (to test on a  single message). If it works on a single message then remove the 'where ID=1' and it will do all of them.

However it is not tested and field names are not accurate - its just enough code to give you an idea!!!



Tony Reid

LakeXeno

Quote from: Dr. Deejay on June 08, 2012, 10:48:44 AM
Hi, welcome to SMF! :)

I have moved your topic to the conversion board, just so you know. :)

Oh, thanks. Still trying to get my head around it all. :)

LakeXeno

Quote from: Tony Reid on June 08, 2012, 11:00:44 AM
Well, you can use the word censor to swap it out, at least that way the users do not see it.

Alternatively,  you probably want to use replace...something like this


update TABLE set FIELD= replace(FIELD,"\'","'") where ID=1


table would probably be smf_messages and field would probably be something like body and id will be the message id (to test on a  single message). If it works on a single message then remove the 'where ID=1' and it will do all of them.

However it is not tested and field names are not accurate - its just enough code to give you an idea!!!

Would the word switch out be resource intensive? I'm on a small board (12k posts, 40-50 daily users) on shared hosting.

LakeXeno

I tried and received this error:


#1054 - Unknown column 'ID' in 'where clause'


This what I used (a specific message ID)

update smf_messages set FIELD= replace(FIELD,"\'","'") where ID=12335

Tony Reid

try this

update smf_messages set FIELD= replace(FIELD,"\'","'") where id_msg=12335

Also, are you sure thats the correct id - is that the message id or the topic id? if its the topic id then you would use id_topic instead
Tony Reid

Advertisement: