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

need simple help writing a simple query for restoring 1 field from a backup

Discussion in 'General PHP and MySQL Discussions' started by wtgw, Nov 2, 2013.

  1. wtgw

    wtgw Member

    I have a xenforo forum with an old backup and current database, both xenforo. I wish to add the old "about" field into the current database's "about" field when user id is the same. Ideally, without repeating any text. So if the old about field says "hobby:woodwork and piano", and the new profile says "hobby:woodwork", I don't want it to say "hobby:woodwork and piano hooby:woodwork". I would like it to say "hobby:woodwork and piano".

    I see the table xf_user_profile but I'm not sure how to write the query.

    How would I do this?

    Will this mess up anything with passwords?
     
  2. HWS

    HWS Well-Known Member

    You need to restore the old table with a different table name (preferable) or into another database (slightly more complicate for your query). Then you simply need to query the old table for the field and insert its value into the new table.
     
  3. wtgw

    wtgw Member

    I have no idea how to do anything beyond pasting the query into phpmyadmin, could you provide an example for dummies? Yes I would back everything up before running it.

    The "about" field is 1 column and when user ID is the same, I would like to add the about info but not add any duplicate words like in my first post. Any help? Thank you in advance.
     
  4. wtgw

    wtgw Member

    Would more information help? I have no clue how to write the query.
     
  5. Jeremy

    Jeremy XenForo Moderator Staff Member

    As far as I'm aware you won't be able to selectively insert data based on what is already in the table. You'll most likely need a full script to do the back up that merges the two data points and sets them in the source database.
     

Share This Page