Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1
    Join Date
    Apr 2006
    Location
    Ohio
    Posts
    6,098
    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.1 Update Release Need help Purchase the Book

  2. #2
    Join Date
    Oct 2006
    Posts
    5,486
    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,098
    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.1 Update Release Need help Purchase the Book

  4. #4
    Join Date
    Oct 2006
    Posts
    5,486
    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,098
    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.1 Update Release Need help Purchase the Book

  6. #6
    Join Date
    Oct 2006
    Posts
    5,486
    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,098
    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.1 Update Release Need help Purchase the Book

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

    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?!?

  9. #9
    Join Date
    Apr 2006
    Location
    Ohio
    Posts
    6,098
    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.1 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. Find & replace feature in editor?
    By kevinmc3 in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 21 Jul 2009, 10:45 PM
  2. how to replace the description of product in bulk?
    By handbag86 in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 6 Jul 2009, 05:41 PM
  3. SQL Patch command / query for changing description.
    By signprint in forum General Questions
    Replies: 3
    Last Post: 15 Mar 2009, 12:34 PM
  4. The word 'insert' in the description
    By seanruk in forum General Questions
    Replies: 2
    Last Post: 29 Jul 2008, 10:43 PM
  5. command to delite all products and categeries?
    By jamesdavid in forum Customization from the Admin
    Replies: 1
    Last Post: 17 Jun 2008, 04:24 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
  •