Migrating table contents to the other table and changing the rules of the game Mysql

I'm stuck yet again with mysql :)

My issue is simple/complicated at the same time.

I prepared dataset which contains columns: user_id, user_email, user_country .......

I need to import/insert this into wp_usermeta table.

wp_usermeta has following columns:

umeta_id (autoincrement), user_id, meta_key, meta_value

So from my dataset, user_id should be user_id, user_email and user_country become meta_keys and their content meta_values.

In the end I expect to get this:

user_id   meta_key        meta_value
12        user_country    Italy
12        user_email      [email protected]

From the lack of correct word for this, I'm trying to "deconstruct" dataset.

Possible with mysql? or should I do php script that will do this for me?


I believe you're looking to do this with a php loop.

Create a query within your script that grabs all of the rows you're looking to bring over.

And then do a while loop that traverses over the results and within that you can do a foreach loop that pulls out the key and value.

Look at the PHP manuel for mysqli_fetch_array. Also, look at this example in particular.

Tags: Mysql / Wordpress

Similar questions

Stop scroll in flash based game in WordPress
I have embedded a flash game in a website but whenever I try to play the game the focus shifts and websites scrolls down. I am not a pro in JavaScript so its giving me a headache. My game is this http://oldgames.cf/2016/12/25/pac-man/ Note :- I have already tried using overflow hidden but it didn't work, I have tried many scripts to make the focus ...
What type of template from WP can be suitable for the site with the game "Quiz"
The task is to create a website with a personal account. On the site will be a game of "Quiz". What template would you recommend to use or better to make a website from scratch? Are there such suitable templates on WordPress or not?
Embedding JAR Game into Wordpress website
Hello I am a designer not a programmer. My brother programmed a game for me a while ago with eclipse. It has the extension JAR. I want to embed this game into my wordpress website but I dont know how. I only have the .exe and the .jar file of the game but not the code. How this can be possible without going into deep programming?
Images are not being displayed, but they are clearly being loaded (Javascript Game being hosted on Wordpress)
So here's the deal. I created this Sonic themed "Brick Breaker" style game that I wanted to host on a Wordpress site. Originally the game had 8 JS files, a CSS file and an HTML file but for the purposes of wordpress I threw everything into one file. My first issue was that the JavaScript wasn't loading, but the images were being displayed as static...
Need to run .exe game file inside web page
I have a .exe game in a folder (it's running without setup) and need to upload it to my hosting so it can view and run it inside my website WordPress page, is it possible?
htaccess disable Wordpress rewrite rules for folder and its contents
I have another PHP application in a folder named app inside my Wordpress installation, and I need to disable all Wordpress rewrite rules for that folder and it's content. So that when I go to www.domain.com/app I get my application page, instead of the standard Wordpress 404 page. I know this is pretty basic apache rewrite rules, and i searched for...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.