Fixing Broken Image Links / SQL Query Code in phpMyAdmin

Avatar
  • updated
  • Answered

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.

  1. A new statement was found, but no delimiter between it and the previous one. (near "UPDATE" at position 36)

SQL query: Documentation

SELECT * FROM `wp3i_posts` WHERE 1 UPDATE wp_posts SET post_content=(REPLACE (post_content, ‘opsinsync.com’,’dev-ois.opsinsync.com’))

MySQL said: Documentation

#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
Avatar
PamB
Quote from Arnel C

Hello Pam,

Most of us do know MySQL, but the problem is often coding can be context related and there may be 100's of different answers.  So, if we don't know the overall context, we might give you good code but it may not be the best answer.  When I state "coding is a little beyond the scope", I'm saying this in the general sense, because we can't provide wholesale coding solutions in this space. However,  for simple queries, we can definitely give an answer and generally at least point you in the right direction.

I had another person look at it for me and he stated that after the "1" there should be some type of punctuation as they are two separate statements.  He said that there should be a ";" separating them.

Hope that helps!

Totally understand.  Thanks!  That solution unfortunately didn't work anyway.  I do appreciate your attempt at the assist though.  Have a good one! 

Avatar
Arnel C
Quote from PamB

Hello Arnel -


This is my first time using community support and so I didn’t think InMotion support would be answering.  I’d already tried contacting support directly.  

I appreciate your response and am aware it’s a delineation issue.  The problem is, however, the first part of that, that ends in WHERE 1.  That’s code that is already there defaulted to) and so on the InMotion side that is being added to the table and so when the table is being built on an install then the proper delineation isn’t being added.  

Anyway...was I mistaken to think that it would be non-InMotion people who would be responding? People who might know SQL? 
 

Hello Pam,

Most of us do know MySQL, but the problem is often coding can be context related and there may be 100's of different answers.  So, if we don't know the overall context, we might give you good code but it may not be the best answer.  When I state "coding is a little beyond the scope", I'm saying this in the general sense, because we can't provide wholesale coding solutions in this space. However,  for simple queries, we can definitely give an answer and generally at least point you in the right direction.

I had another person look at it for me and he stated that after the "1" there should be some type of punctuation as they are two separate statements.  He said that there should be a ";" separating them.

Hope that helps!

Avatar
PamB

Hello Arnel -


This is my first time using community support and so I didn’t think InMotion support would be answering.  I’d already tried contacting support directly.  

I appreciate your response and am aware it’s a delineation issue.  The problem is, however, the first part of that, that ends in WHERE 1.  That’s code that is already there defaulted to) and so on the InMotion side that is being added to the table and so when the table is being built on an install then the proper delineation isn’t being added.  

Anyway...was I mistaken to think that it would be non-InMotion people who would be responding? People who might know SQL? 
 

Avatar
Arnel C
  • Answered

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.