Need php/MySQL expert advice

by Alminc
5 replies
I am trying to replace a portion of text within MySQL field,
using this type of query:

UPDATE tblarticles SET textArticle=REPLACE(textArticle, 'part of text to be replaced' , 'replacement');



When I run this query in phpMyAdmin , nothing is executed:

Affected rows: 0 (Query took 0.0019 sec)

I use phpMyAdmin version 2.11.9.1
MySQL version 4.1.22

Can you please tell me why the above query does not work for me ( it should work according to the manual) ?
Am I doing something wrong? Is the above query complete?
#advice #expert #php or mysql
  • Profile picture of the author Valdor Kiebach
    All the instructions for this I have seen use lowercase for replace and double quotes, dont know if this is the problem or not.

    UPDATE tablename SET tablefield = replace(tablefield,"findstring","replacestring");
    You could also make sure that the user you logged into phpmyadmin with has the correct permission to do this (which i think they would have anyway)
    {{ DiscussionBoard.errors[362508].message }}
  • Profile picture of the author radhika
    Originally Posted by Alminc View Post

    I am trying to replace a portion of text within MySQL field,
    using this type of query:

    UPDATE tblarticles SET textArticle=REPLACE(textArticle, 'part of text to be replaced' , 'replacement');
    Am I doing something wrong? Is the above query complete?

    UPDATE tblarticles SET textArticle = REPLACE (textArticle,"part of text to be replaced","replacement");

    Try above.

    .
    Signature
    Follow up Autoresponder PRO :: 33% Discount!!
    FREE Upgrades! IMPROVED Email Deliverability!!
    {{ DiscussionBoard.errors[362521].message }}
    • Profile picture of the author Alminc
      Thank you, but that is not the problem, I tested it.
      Signature
      No links :)
      {{ DiscussionBoard.errors[362545].message }}
      • Profile picture of the author radhika
        These are case sensitive (table names, column names):
        tblarticles
        textArticle
        So they are correct?


        As a user you have privilege to update/modify database?

        .
        Signature
        Follow up Autoresponder PRO :: 33% Discount!!
        FREE Upgrades! IMPROVED Email Deliverability!!
        {{ DiscussionBoard.errors[362554].message }}
        • Profile picture of the author Alminc
          I just discovered that the problem was in incorrect escaping, since the text I wanted to replace contained the url. So I needed to play with backslashes and single/double quotes until it worked.

          Thank you for your help guys.
          Signature
          No links :)
          {{ DiscussionBoard.errors[362586].message }}

Trending Topics