"aabb", by running the query: UPDATE `question` SET `text` = REPLACE(`text`, 'aa;bb', 'aabb') WHERE INSTR(`" /> "aabb", by running the query: UPDATE `question` SET `text` = REPLACE(`text`, 'aa;bb', 'aabb') WHERE INSTR(`" /> "aabb", by running the query: UPDATE `question` SET `text` = REPLACE(`text`, 'aa;bb', 'aabb') WHERE INSTR(`"/>

Escaping semicolon in phpmyadmin

1.6k Views Asked by At

In PHPMyAdmin I want to replace "aa;bb" -> "aabb", by running the query:

UPDATE `question` SET `text` = REPLACE(`text`, 'aa;bb', 'aabb') WHERE INSTR(`text`, 'aa;bb') > 0;

but I get an error:

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 ''aa)' at line 1

The error occurs always I put a semicolon in the string. Also, the semicolon does not work in searh or find and replace in PHPMyAdmin.

2

There are 2 best solutions below

0
XING On

The error occurs always I put a semicolon in the string. Also, the semicolon does not work in searh or find and replace in PHPMyAdmin

Try this:

UPDATE `question` SET `text` = REPLACE(`text`, 'aa\;bb', 'aabb') WHERE INSTR(`text`, 'aa;bb') > 0;
3
Matt Cosentino On

I had to change the delimiter from a semicolon to something else, I used a vertical bar.