0

How can I remove or replace a string from a column? eg: I want from my articles to remove the string:

<p>John say's "Hello Mary"</p>

I try with the REPLACE() function in phpmyadmin but I get an error. The query is the below:

select `column_name` REPLACE('<p>John say's "Hello Mary"</p>', '<p>John say's "Hello Mary"</p>', '') where id=1234;

Thank you

1
  • Take a moment to read through the editing help in the help center. Formatting on Stack Overflow is different than on other sites. The better your post looks, the easier it is for others to read and understand it. Commented Mar 10, 2022 at 13:30

2 Answers 2

1

The REPLACE() function is often used to correct data in a table, replacing the old string with the new one.

The following is the syntax:

UPDATE 
    table_name
SET
    column_name = REPLACE(column_name, '<p>John say's "Hello Mary"</p>','')
WHERE
    id=1234;
Sign up to request clarification or add additional context in comments.

Comments

0

The syntax for REPLACE() is like this:

SELECT REPLACE(column_name ,'something','somewhat') FROM your_table WHERE id = 1234;

Also pay attention to quotes: 'John say's "Hello Mary"' - you must escape the one from

say's

for example

2 Comments

Thanks, I get this error now "Current selection does not contain a unique column. Grid edit, checkbox, Edit, Copy and Delete features are not available. "
@DimitrisT. That sounds like a phpMyAdmin message. It is not an error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.