作者Caput (嗨卡噗特)
看板Web_Design
标题[问题] #1064 SQL错误 更改wp文章内图网址
时间Thu Mar 17 21:35:00 2016
大家好
因为最近网站使用Cloudflare免费的SSL
所以网址改成https
但是以前的文章里面图片连结还是http
会导致图片无法显示
我就参考网路上教学
到phpMyAdmin的SQL来更新图片连结
语法如下:
UPDATE wp_posts
SET post_content = ( Replace (post_content, 'src="
http://', 'src="//') )
WHERE Instr(post_content, 'jpeg') > 0
OR Instr(post_content, 'jpg') > 0
OR Instr(post_content, 'gif') > 0
OR Instr(post_content, 'png') > 0;
但就会出现这个错误
#1064 - You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
'SET post_content = ( Replace (post_content, 'src="
http://', 'src="//') )
WHERE I' at line 2
MySQL版本 5.1.73
phpMyAdmin版本 4.3.8
希望有人能解决我的问题
感激不尽
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 218.173.33.52
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Web_Design/M.1458221706.A.A09.html
1F:→ kattte: 你要做的是把原本存图片资料的栏位 加上httP:// ?03/19 19:55
是替换,把http://换成//
※ 编辑: Caput (180.217.212.176), 03/20/2016 00:43:03
2F:推 BiNoKo: wp_posts要加单引号03/23 16:51
3F:→ BiNoKo: 好像不是XD 请从第二行的单引号试试看?03/23 16:54
後来爬文有人说直接用phpMyadmin的搜寻取代,就成功更改了!还是谢谢你~
※ 编辑: Caput (180.217.243.203), 03/30/2016 13:23:41