PHPCMS 100个常见问题(二)
Q12.将标题中指定的字符串删除:
UPDATE phpcms_content SET title=REPLACE(title, ‘落伍投资’, ”);
Q13.查询内容中包含指定字符串的文章:
select contentid, content from phpcms_c_news where content like ‘%文章来源:落伍投资 %’
Q14.将文章内容中指定的版权信息替换。
UPDATE phpcms_c_news SET content=REPLACE(content, ‘(文章来源:路遇交友网‘, ‘(文章来源:落伍投资 http://www.65.la’);
Q15.虽然文章已经被删除,但是在搜索结果中依然出现该文章,怎么办?
因为phpcms_search表中依然保存了该文章的关键字,所以搜索关键字时会有该文章出现,但是点击链接会出现404错误。
delete phpcms_search from phpcms_search where data like ‘%mj%’
Q16.查询指定栏目的对应的内容列
select * from phpcms_c_news where content like ‘%落伍投资%’ && contentid in (select contentid from phpcms_content where catid =37)
Q17.查询所有栏目编号
select distinct from phpcms_content;
Q18.删除指定字符串中间的内容
select CONCAT(LEFT(content,INSTR(content,’删除开始位置’)),RIGHT(content,LENGTH(content)-INSTR(content,’删除结束位置’)))