![]() |
[Discuz]MySQL 取代文章內容字串語法 - 可列印版本 +- 餅乾工坊 (http://ninja.s12.xrea.com/mybb) +-- 版面: 電腦網路 (http://ninja.s12.xrea.com/mybb/forumdisplay.php?fid=2) +--- 版面: 網頁相關 (http://ninja.s12.xrea.com/mybb/forumdisplay.php?fid=13) +--- 主題: [Discuz]MySQL 取代文章內容字串語法 (/showthread.php?tid=304) |
[Discuz]MySQL 取代文章內容字串語法 - NINJA - 10-24-2009 如果想改某個字串,可以用下面的方法取代 程式碼: update cdb_posts set message=replace(message,'[flash','[media=swf'); delete from cdb_posts where first=0 刪除ID1版塊的回覆: delete from cdb_posts where fid =1 and first = 0; 刪除第6556個主題的所有回覆: delete from cdb_posts where tid =6556 and first = 0 論壇ID23板塊裡所有回覆長度小於20的而且沒有附件的回覆全部刪除掉 delete from cdb_posts where length(message)<20 and attachment=0 and fid=23 一次性給一個貼內的所有回覆人加積分 update cdb_members set extcredits2=extcredits2+10 where uid in(SELECT authorid FROM `cdb_posts` WHERE tid=主題ID) extcredits2 是需要增加的積分字段 , 使用的時候要注意增加的哪個積分字段 批次刪除ID23板塊裡的所有主題 delete from cdb_threads where fid=23 批次替換ID24板塊裡,所有回覆中指定的字元串 UPDATE cdb_posts SET message=REPLACE(message,'要替換的字元串','替換後的字元串') where fid=24 批次替換文章內容顯示頁標題字元 引用: UPDATE cdb_posts SET subject=REPLACE(subject,'要替換的字元串','替換後的字元串'); 批次替換文章標題字元 UPDATE cdb_threads SET subject=REPLACE(subject,'要替換的字元串','替換後的字元串'); 批次在回覆的前後加入字元串1和字元串2 UPDATE cdb_posts SET message=CONCAT('字元串1',message,'字元串2') where fid=24 |