• Hi everybody,
    I am not that much familiar with mySQL, but maybe somebody can help me. Here is my problem:

    Question summary: I want to export the data of the field “director” and import it into a field called “new_director”.

    Detailes:
    I am working on a movie website that has (after a relaunch) the same type of information stored in two different places in the database and I want to bring both parts together. Therefore I must export some data and then import them.

    The two places are:
    1) The older posts have information that is stored in the table wp_postmeta. As it is a movies website, there are metakeys like “director” and metavalues like “Stanley Kubrik” or “Steven Spielberg” That is the information I want to export.

    2) The newer posts have the information stored in another place: Since the relaunch the website uses “advanced custom fields” for these data. In ACF the metakey is called “new_director” and the metavalues are again the names of the directors (Kubrik…) . Here I want to import the data.

    Does anybody know how to resolve that problem? That would be great!
    Thanks
    Raphael

    • This topic was modified 4 years, 3 months ago by rabox66.
    • This topic was modified 4 years, 3 months ago by rabox66.
    • This topic was modified 4 years, 3 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Developing with WordPress topic
Viewing 4 replies - 1 through 4 (of 4 total)
  • The data is in the exact same place it would be if exported and imported. All you need to do is rename the key. However, the ACF plugin uses a naming scheme involving numbers, so your best bet is to ask at the ACF support forum how to proceed.

    I also made a movie website, for a client, and I used taxonomies for the directors and actors. It made it very simple to list all the movies by director and actor. In fact, I only used post meta for the release year, so I could sort by that. (We put the year at the end of the post title also, to handle remakes.)

    Thread Starter rabox66

    (@rabox66)

    Hi joy,
    thank you for the answer, but I am nor sure if that is the best possiblity.
    If I have in my database “director” and ‘new_director’ and I change the first (‘director’) to the second (‘new_director’) It might occure that I have in the same post two metakeys of the same name. That is not a very solid solution, cause it can lead to further trouble.

    The magic question is: How to
    1) export the metavalue of each metakey ‘director’, lets say to Exel.
    2) then to erase the whole line
    as it is no longer needed (that part is mandatory)
    3) and import the metavalue into ‘new_director’

    I am really no MySQL-expert. But it does not seem to be really hard. And I do not need to ask in ACF-support. It is a simple MySQL-question, as far as I understand it. (Hope so. ?? )

    • This reply was modified 4 years, 3 months ago by rabox66.

    Th reason to ask in ACF support is because the name of the meta key might seem to be ‘new_director’, but ACF could be storing it as something else. So to get the correct MySQL, you need to know that, and only they know that for sure.

    Thread Starter rabox66

    (@rabox66)

    No, it is stored in the database like ‘new_director’. I saw it in MySQLadmin.

    But the main question is to export/import. It cannt be that much difficult. ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Export/import specific data from MySQL’ is closed to new replies.