Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1
    Join Date
    Apr 2006
    Location
    Ohio
    Posts
    6,112
    Plugin Contributions
    0

    Default SQL command to find and replace a word in the products description?

    Need help with a SQL command to find and replace one word in the products_description table, and set products_description to a new word, where products_description is this word..

    I have the word hematite around 400 times in the product_description and want to change to magnatite

    UPDATE products_description
    SET products_description = 'magnatite'
    WHERE products_description = 'hematite';

    1. admin panel/ tools/ install sql patches
    2. I insert the following and get 1 processed but no change
    3. What is wrong...
    Mark
    Hare Do - Does the rabbit beat Zen "never".
    Zen Cart 1.5.5a Update Release Need help Purchase the Book

  2. #2
    Join Date
    Oct 2006
    Posts
    5,481
    Plugin Contributions
    12

    Default Re: SQL command to find and replace a word in the products description

    I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

  3. #3
    Join Date
    Apr 2006
    Location
    Ohio
    Posts
    6,112
    Plugin Contributions
    0

    Default Re: SQL command to find and replace a word in the products description

    Quote Originally Posted by yellow1912 View Post
    Yellow1912,
    SELECT REPLACE('hematite', 'hematite', 'magnatite');

    1. I click send
    2. 1 statement processed
    3. But no change on the page.
    4. What is wrong???
    Mark
    Hare Do - Does the rabbit beat Zen "never".
    Zen Cart 1.5.5a Update Release Need help Purchase the Book

  4. #4
    Join Date
    Oct 2006
    Posts
    5,481
    Plugin Contributions
    12

    Default Re: SQL command to find and replace a word in the products description

    Select is ....select, that's it, it doesnt do anything to the records

    You have to use update instead of select if you want to make changes to your db. Always back up first.
    I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

  5. #5
    Join Date
    Apr 2006
    Location
    Ohio
    Posts
    6,112
    Plugin Contributions
    0

    Default Re: SQL command to find and replace a word in the products description

    Quote Originally Posted by yellow1912 View Post
    Select is ....select, that's it, it doesnt do anything to the records

    You have to use update instead of select if you want to make changes to your db. Always back up first.
    Yellow1912,
    Thank you,

    UPDATE products_description SET products_description = REPLACE('hematite', 'hematite', 'magnatite');

    1. Yes i am on a demo site.
    2. thanks for the reminder of database backup
    3. when I put the code in above it eliminate all my wording and places magnatie
    4. Instead of:
    5. Magnatite is a gods natural stone. etc. etc
    Mark
    Hare Do - Does the rabbit beat Zen "never".
    Zen Cart 1.5.5a Update Release Need help Purchase the Book

  6. #6
    Join Date
    Oct 2006
    Posts
    5,481
    Plugin Contributions
    12

    Default Re: SQL command to find and replace a word in the products description

    well, because you are doing it incorrectly. Always, always read the document carefully, it is straight forward.

    An example they use

    mysql> SELECT REPLACE('www.mysql.com', 'w', 'Ww');
    -> 'WwWwWw.mysql.com'
    So in your case you may want to try

    UPDATE products_description SET products_description = REPLACE(products_description, 'magnatite', 'hematite');

    Something like that. Assuming you want to change from magnatite to hematite
    I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

  7. #7
    Join Date
    Apr 2006
    Location
    Ohio
    Posts
    6,112
    Plugin Contributions
    0

    Default Re: SQL command to find and replace a word in the products description

    Yellow1912,

    Thanks for your time..
    Was up working late on that little task.
    Was close, but yet far from the theory.

    The correct path with your help was:

    UPDATE products_description SET products_description = REPLACE(products_description, 'hematite', 'magnatite');
    Mark
    Hare Do - Does the rabbit beat Zen "never".
    Zen Cart 1.5.5a Update Release Need help Purchase the Book

  8. #8
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    5,886
    Plugin Contributions
    8

    Default Re: SQL command to find and replace a word in the products description

    You will also need to decide if you are going to use magnEtite or magnAtite.

    Either could be correct. Magnetite is the actual mineral while magnatite is generally manufactured. Either way, make sure you have both in the keywords.
    Did you read the posting tips?!?
    Responsive Color Changes for 155 demo here.

  9. #9
    Join Date
    Apr 2006
    Location
    Ohio
    Posts
    6,112
    Plugin Contributions
    0

    Default Re: SQL command to find and replace a word in the products description

    Dbltoe2,
    Thanks for the English lesson and the heads up on the keywords.

    Enjoy Bunco tonight...
    Mark
    Hare Do - Does the rabbit beat Zen "never".
    Zen Cart 1.5.5a Update Release Need help Purchase the Book

  10. #10
    Join Date
    Oct 2008
    Posts
    6
    Plugin Contributions
    0

    Default Re: SQL command to find and replace a word in the products description

    I am attempting to do the same thing. However, I am trying to change item descriptions from 2x3' to 2x3 Foot. I get this error. HELP PLEASE! I have over 3000 products on the site and I need this to be updated ASAP. Thanks everyone.


    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 '2x3 Foot')' at line 1
    in:
    [UPDATE zen_products_description SET products_description = REPLACE('2x3'', '2x3 Foot');]
    If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 3
    Last Post: 11 May 2012, 12:35 PM
  2. v139h SQL find and replace
    By gloerick in forum General Questions
    Replies: 2
    Last Post: 30 Mar 2012, 01:16 PM
  3. Word HEADER_ bin the menu bar and after the word login
    By moro in forum Installing on a Windows Server
    Replies: 1
    Last Post: 18 Dec 2011, 03:14 PM
  4. Adding an attribute to all products using SQL command?
    By arniesbarmyarmy in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 20 Oct 2009, 03:47 AM
  5. SQL Patch command / query for changing description.
    By signprint in forum General Questions
    Replies: 3
    Last Post: 15 Mar 2009, 12:34 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR