Search and Repalce - MySQL

When I first started building mys computer components website I was totally new to programming - I knew a little HTML but that was it.

Thankfully on the Internet there are a few helpful people who are willing to share their skill of PHP and MySQL.

You can use this code in phpmyadmin or any other database manager

UPDATE table name SET Table Field = replace(table field,"string to find","string to replace")

On of the things that I found really helpful was how to search for a specific string within a database and replace that string. There are hundreds of reasons that you may wish to do this but an example is this:

Say within your site you are optimising you product pages and you want to ensure you internal linking structure points your users to the correct pages. You could search for every instance of ” computer components ” and make it link to the relevant page. This is great fro SEO purposes.

Of course there are other reasons why you may use it, perhaps you want to add a style or class to every table. This is made easy with search and replace.

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Mixx
  • StumbleUpon
  • Technorati

29 Responses to “Search and Repalce - MySQL”

  1. mark from phone service Says:

    That is a great tip. It does make a difference in Seo if you do this. Since it takes very little time everyone should do it to help sites seo.

    marks last blog post..Broadband phone voip service.

  2. Sam from DIY Solar Panels Says:

    Omg this rocks! This would be great for SEO. Thank you very much!

  3. Rob from Online Poker Rakeback Says:

    Well there’s something I didn’t know. Right now I’m about where you were when you first started. As you said, great for SEO, but it seems that it would also be a big timesaver. Thank you for the tip.
    *bookmarked*

    Robs last blog post..SNG Strategy Pt. 2 - Make money playing Sit and Go poker tournaments

  4. cathy from Key west travel Says:

    That is a good idea. It does seem to help seo of the site and should let you get more traffic.

    cathys last blog post..Hotels in key west.

  5. chuggin from good coffee makers Says:

    I tried my best, but I had to break down and outsource from Elance.

  6. amy from Black mold removal Says:

    Thanks i have to try and do this. I know it helps each page in search engines and should help get more website traffic.

    amys last blog post..Mold removal.

  7. Mark from Review Says:

    I was wondering if this code can be used in ASP.net. I am kind of novice in this. Please help me out.

  8. 642-533 exam Says:

    Very impressed with the knowledge you are posting here. Thanks for sharing and let us know more about new releases. 642-825 exam

  9. Amy from Free Xbox 360 Says:

    That seems like a great concept for SEO. I know next to nothing about web design, I’ve started stumbling around CSS and XHTML, php is a mystery to me.

  10. matthew from internet franchises Says:

    Ahhh well, I dont code so it’s all gobbledygook to me. Will point my coder to it though and see if it is of use :D

  11. Vancouver Web Design Says:

    This is an enormous time saver, thank you !

  12. siamese cat Says:

    The best example over the net. I have been (re)searching this topic for quite some time unfortunately there is a bunch of logs quoting this “update [table_name] set [field_name] = replace([field_name],’[string_to_find]‘,’[string_to_replace]‘);”

    which works only in the most idiotic cases. The examples above are golden :)

    Thanx!

  13. rasim from How Do I Get Rid Of The Trojan Horse Virus Says:

    great blog I love that you keeped your blog keywordluv thanks.

  14. austinjames from SEO Marketing Ireland Says:

    Nice tips here!
    Thanks for the linkback to my site because of keyword luv

  15. jon-jon from songs Says:

    Well, I really admire SQL and html.

    I think people who want to get settled with internet world or make money out of it, should get at least very basic foundation of both.

  16. Greig from Leadership Says:

    A veru useful little string there - one that my low level of coding knowledge wouldn’t have allowed me to create on my own, so thankyou!

  17. rasmus from søgemaskineoptimering Says:

    Great tip! thank you.
    Does this SQL sentence work with mssql aswell? Anyone?

  18. Hotels Says:

    Well, I too admire SQL and html.

    These are very easy to learn and they pay you higher.

  19. Neeraj Says:

    Besides having some computer knowledge one must have command over English.

  20. Jewellery Says:

    I am very impress this site. sql server is very nice, so thanks for this post.

  21. Tollywood songs Says:

    Thank u ver much for posting such a nice article on sql

  22. bennet from english speaking course Says:

    This is an amazing idea. Thanks for this excellent tip which would be very useful for seo. I will bookmark your site. Thanks a ton for posting such an awesome article. Love to read most of your writings.

  23. manu from advertising agency toronto Says:

    Its a great tip.I am experiencing it in my daily work.Thanks for such valuable post.

  24. senior dating services Says:

    i think its a great tip and i really like this stuff its time saver.

  25. sam from Mp3 download song Says:

    this is a great tip and pretty impressive and thanks for sharing

  26. Towel Warmers Says:

    I like phpmy admin to do the database stuff - it’s easier

  27. sam from How to make money in Philadelphia Says:

    this is wonderful to read and pretty interesting and sql server is nice and thanks for sharing.

  28. sam from Chiropractic software Says:

    well i don’t have so much knowledge of mysql but i have knowledge of HTML,this is good to read,
    thanks!

  29. accept checks by fax Says:

    Wrong query syntax may ruin the field you are performing replace on, so always backup first.

Leave a Reply

This site uses KeywordLuv. Enter YourName@YourKeywords in the Name field to take advantage.