Fixing Broken Image Links / SQL Query Code in phpMyAdmin
Hello - I'm hoping someone can help me out with what appears to be a syntax error in an SQL query in myPHPAdmin. Thanks in advance!!
I am fixing image links after copying a website into a development environment. I am following the instructions at this article. https://www.inmotionhosting.com/support/edu/wordpress/correct-image-links/
When I go into wp_posts in phpMyAdmin (in my case the table is actually called wp3i_posts) I am getting the error below. First...here's the code I entered AND also what - by default was already on Line 1 in the code box.
SELECT * FROM `wp3i_posts` WHERE 1
UPDATE wp3i_posts SET post_content=(REPLACE (post_content, ‘opsinsync.com’,’dev-ois.opsinsync.com’));
HERE'S THE ERROR MESSAGE
Error
Static analysis:
1 errors were found during analysis.
- A new statement was found, but no delimiter between it and the previous one. (near "UPDATE" at position 36)
SQL query:
SELECT * FROM `wp3i_posts` WHERE 1 UPDATE wp_posts SET post_content=(REPLACE (post_content, ‘opsinsync.com’,’dev-ois.opsinsync.com’))
MySQL said:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UPDATE wp_posts SET post_content=(REPLACE (post_content, ‘opsinsync.com’,...' at line 2
Hello PamB,
Sorry for the issues with your SQL code. Typically, coding is a little beyond the scope of what we can provide, but we do try to provide direction in regards to these update statements. The SQL statement that you provided:
SELECT * FROM `wp3i_posts` WHERE 1
UPDATE wp3i_posts SET post_content=(REPLACE (post_content, ‘opsinsync.com’,’dev-ois.opsinsync.com’));
The error message has to do with the "1" after WHERE. You need to properly define the selection query, it can't be just "1".
If you have any further questions or comments, please let us know.
Kindest Regards,
Arnel C.