Quote:
Originally Posted by SpeedoDave
Sarettah,
Awesome response mate.
Dave
|
Except that I screwed up a bunch of syntax. My brain fell away from mysql and dropped back to a different sql that understands + as the concat operator.
Oh well.
So every where that I did the + in the queries should have used a concat() function instead.
I also should have a where condition to see if post_content has anything in it.
So, the examples I used up there will not work and instead need to look like this:
update wp_posts set post_content=concat('<a href="http://url_to_link_to_goes_here">',trim(post_content),'</a>') where trim(post_content)>''
Cams.com update: update wp_posts set post_content=concat('<a href="http://cams.com_url_goes_here">', trim(post_content), '</a>') where post_content like '%cams.com%' and trim(post_content)>''
Chaturbate update: update wp_posts set post_content=concat('<a href="http://chaturbate.com_url_goes_here">', trim(post_content), '</a>') where post_content like '%chaturbate.com%' and trim(post_content)>''
update wp_posts set post_content=concat('<a href="',
case
when instr(post_content,'chaturbate.com')>0 then 'http://chaturbate.com_url_goes_here'
when instr(post_content,'cams.com')>0 then 'http://cams.com_url_goes_here'
else
'http://default_url_goes_here'
end
, '">' , trim(post_content) , '</a>') where trim(post_content)>''
I hate when I fuck up like that. It seems to happen about 4 billion times a day
.