[問題] #1064 SQL錯誤 更改wp文章內圖網址

看板Web_Design作者 (嗨卡噗特)時間9年前 (2016/03/17 21:35), 9年前編輯推噓1(102)
留言3則, 2人參與, 最新討論串1/1
大家好 因為最近網站使用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://www.ptt.cc/bbs/Web_Design/M.1458221706.A.A09.html

03/19 19:55, , 1F
你要做的是把原本存圖片資料的欄位 加上httP:// ?
03/19 19:55, 1F
是替換,把http://換成// ※ 編輯: Caput (180.217.212.176), 03/20/2016 00:43:03

03/23 16:51, , 2F
wp_posts要加單引號
03/23 16:51, 2F

03/23 16:54, , 3F
好像不是XD 請從第二行的單引號試試看?
03/23 16:54, 3F
後來爬文有人說直接用phpMyadmin的搜尋取代,就成功更改了!還是謝謝你~ ※ 編輯: Caput (180.217.243.203), 03/30/2016 13:23:41
文章代碼(AID): #1MwhAAe9 (Web_Design)
文章代碼(AID): #1MwhAAe9 (Web_Design)