Query assist

beerForo

Well-known member
Need to change these

[sharedmedia=core:attachments:1234]

to these

[ATTACH]1234[/ATTACH]

respectively (number-wise)

Thanks if you can help!
 
My best guess

UPDATE 'table_name' SET 'field_name' = replace(same_field_name, '[sharedmedia=core:attachments:', '[ATTACH]')

and

UPDATE `table_name` SET 'field_name' = replace(same_field_name, ']', '[/ATTACH]')
 
You will have to use regex as there is no way of matching the ] just for those strings.

If you do this -- UPDATE `table_name` SET 'field_name' = replace(same_field_name, ']', '[/ATTACH]') -- it will update every bb code in the post table with a closing ] to [/ATTACH].
 
If it's for the XF post table, with this add-on:

 
Post in the resource thread - someone should be able to help with crafting the regex required.
 
Top Bottom