채택완료

phpmyadmin에서 특정문구 치환

2021-10-02 (토) 14:08:58 2,983

update 테이블 wr_content=REPLACE(wr_content,'기존단어','바꿀단어')

이렇게 알고 있습니다.

<img src = <img src='https://taesarang.com

이 부분을 

<img src="https://thailove.net/taesarang

이렇게 바꾸기 위해

UPDATE g5_write_01_1 SET wr_content=REPLACE(wr_content,'<img src = <img src='https://taesarang.com','<src="https://thailove.net/taesarang') ;

이렇게 하고 실행했는데

바꿀 단어 안에 작은 따옴표가 있어서 그런가 아래와 같은 오류가 나오네요.

이럴 경우 어떻게 해야 할까요?

정적 분석 :

분석 중에 1개의 오류가 발생했습니다.

  1. 닫는 따옴표 " 가 팔요합니다. (near "" at position 140)

SQL 질의: 복사

update g5_write_free set wr_content=REPLACE(wr_content,'<img src = <img src='https://taesarang.com','<src="https://thailove.net/taesarang');

MySQL 메시지: 문서

#1064 - 'SQL 구문에 오류가 있습니다.' 에러 같읍니다. ('https://taesarang.com','<src="https://thailove.net/taesarang')' 명령어 라인 1)
 

|

답변 2개 / 댓글 2개

채택된 답변
+20 포인트

UPDATE g5_write_01_1 SET wr_content=REPLACE(wr_content,'<img src = <img src=\'https://taesarang.com','<img src="https://thailove.net/taesarang') ;

답변에 대한 댓글 1개

덕분에 잘 처리 하였습니다 ^^
주말 휴일 잘 보내세요, 감사합니다~
MySQL recognizes the following escape sequences.
\0     An ASCII NUL (0x00) character.
\'     A single quote (“'”) character.
\"     A double quote (“"”) character.
\b     A backspace character.
\n     A newline (linefeed) character.
\r     A carriage return character.
\t     A tab character.
\Z     ASCII 26 (Control-Z). See note following the table.
\\     A backslash (“\”) character.
\%     A “%” character. See note following the table.
\_     A “_” character. See note following the table.

답변에 대한 댓글 1개

제가 꼬꼬마라서 어설픕니다 ㅠㅠ
감사합니다~ 주말 휴일 잘 보내세요~

답변을 작성하려면 로그인이 필요합니다.