1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Need to run a MySQL query before importing, will this work?

Discussion in 'General PHP and MySQL Discussions' started by Ludachris, May 14, 2014.

  1. Ludachris

    Ludachris Well-Known Member

    I need to change all user submitted data in 'field2' of my 'userfield' table in vB and replace spaces with underscores. I figured I'd jump into phpmyadmin and run it. Will this do what I'm need:

    UPDATE userfield SET field2 = REPLACE(field2, ' ', '_') WHERE field2 LIKE '% %;

    I'm going to run in on a copied db. I just need to make sure it works as I'll have to do it right before doing my final import. I'm going to be using the Big Board Importer, which is why I have to do this. The standard importer doesn't require this step.

    Thanks in advance.
    Last edited: May 14, 2014
  2. Vladislav Rastrusny

    Vladislav Rastrusny Active Member

    There is no need in WHERE clause if you really need to change all the fields. Just make it

    UPDATE userfield SET field2 = REPLACE(field2, ' ', '_')
    Of course database backup is a must.

Share This Page