I have something similar to the following structure:
Array
(
[wp_postmeta] => Array
(
[0] => stdClass Object
(
[meta_id] => 1
[post_id] => 2
[meta_key] => _wp_page_template
[meta_value] => default
)
)
[wp_comments] => Array
(
[0] => stdClass Object
(
[comment_ID] => 1
[comment_post_ID] => 1
[comment_author] => Mr WordPress
[comment_author_email] =>
[comment_author_url] => http://wordpress.org/
[comment_author_IP] =>
[comment_date] => 2011-10-20 03:06:23
[comment_date_gmt] => 2011-10-20 03:06:23
[comment_content] => Hi, this is a comment.
[comment_karma] => 0
[comment_approved] => 1
[comment_agent] =>
[comment_type] =>
[comment_parent] => 0
[user_id] => 0
)
)
)
What I'm trying to do here is iterate over these results so I can use them to form a query.
Assume all the data within the wp_postmeta table is deleted from the database and this array contains the data of that table before it was deleted. I want to take this saved data in the array and reset the table with these old values.
I.e Looping through the array and inserting this as sql: INSERT INTO wp_postmeta (meta_id, post_id, meta_key, meta_value) VALUES (1, 2, '_wp_page_template', 'default')