Title: phpMyAdmin: Export &#8211; Edit &#8211; Import
Last modified: June 14, 2019

---

# phpMyAdmin: Export – Edit – Import

 *  Resolved [netstepinc](https://wordpress.org/support/users/netstepinc/)
 * (@netstepinc)
 * [6 years, 12 months ago](https://wordpress.org/support/topic/phpmyadmin-export-edit-import/)
 * In this other thread:
    [https://wordpress.org/support/topic/export-import-tabs-content-from-phpmyadmin/](https://wordpress.org/support/topic/export-import-tabs-content-from-phpmyadmin/)
 * Your support response yikesitskevin (@yikesitskevin) 4 months, 2 weeks ago
    “
   Did you perhaps run any search and replace functions on the database before/after
   you imported the tabs? If the content of the tab was changed at all, they wouldn’t
   be imported properly.”
 * I’m in desperate need of a search/replace within the tab data.
    I’ve attempted
   very minor edits such as deleting 4 characters. The original imports fine, but
   the slight edit does not.
 * Is there a trick to doing this?

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [netstepinc](https://wordpress.org/support/users/netstepinc/)
 * (@netstepinc)
 * [6 years, 12 months ago](https://wordpress.org/support/topic/phpmyadmin-export-edit-import/#post-11637146)
 * I built an external script that enabled me to unserialize > edit > serialize 
   and update the meta_values.
 *  Plugin Contributor [yikesitskevin](https://wordpress.org/support/users/yikesitskevin/)
 * (@yikesitskevin)
 * [6 years, 12 months ago](https://wordpress.org/support/topic/phpmyadmin-export-edit-import/#post-11638026)
 * That is the perfect way to go about editing tabs from the code [@netstepinc](https://wordpress.org/support/users/netstepinc/).
 * Would you mind sharing your script?
 *  Thread Starter [netstepinc](https://wordpress.org/support/users/netstepinc/)
 * (@netstepinc)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/phpmyadmin-export-edit-import/#post-11651204)
 * This is not fancy, but it worked for me.
    **edit_yikes_tabs.php**
 *     ```
       <?php
       /*INSTRUCTIONS
       WARNING: This is built for a specific purpose and limited use. Do not leave this in your website in the current form.
       NOTE: URL parameter &go=0 is for testing. &go=1 will execute the update so don't change that until you're ready.
   
       1. Copy db settings from wp-config file and paste below
       2. Define the TABLE_POSTMETA value below.
       3. Upload to your website web directory
       4. Test it at http://EXAMPLE.COM/edit_yikes_tabs.php?search=FIND&replace=REPLACE&go=0
       5. DELETE the file from your website when done. This is quick primitive unsecure code.
       */
   
       //DB CONNECT
       define('DB_NAME','');
       define('DB_USER','');
       define('DB_PASSWORD','');
       define('DB_HOST', 'localhost');
       define('TABLE_POSTMETA','wp_postmeta');
   
       $search = $_GET['search'];
       $replace = $_GET['replace'];
       $execute = $_GET['go'];
   
       echo '<div>SEARCH: '.$search.'</div>';
       echo '<div>REPLACE: '.$replace.'</div>';
   
       // Create connection
       $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
       if ($mysqli->connect_error) {
       	die("Connection failed: " . $mysqli->connect_error);
       } 
       mysqli_set_charset($mysqli,"utf8");
   
       // Perform an SQL query
       $sql = "SELECT <code>meta_id</code>,<code>meta_value</code> from ".TABLE_POSTMETA." where <code>meta_key</code> = 'yikes_woo_products_tabs'";
   
       // to get the error information
       if (!$result = $mysqli->query($sql)) {
           echo "Error: Our query failed to execute and here is why: \n";
           echo "Query: " . $sql . "\n";
           echo "Errno: " . $mysqli->errno . "\n";
           echo "Error: " . $mysqli->error . "\n";
           exit;
       }
       if ($result->num_rows === 0) {
           echo "No results";
           exit;
       }
   
       while ($data = $result->fetch_assoc()) {
       	$value = unserialize($data['meta_value']); 
   
       	echo '<div style="margin:10px; padding:10px; border:1px solid #00CC00; background:#FFFFCC">';
       	echo 	'ORIGINAL SERIALIZED TAB DATA: <b>postmeta id: ' . $data['meta_id'] . '</b><br>' . $data['meta_value'];
       	echo 	'<hr><b>BEFORE</b><br>'; print_r($value);
   
       	for($i=0; $i < count($value); $i++){
       		$content = $value[$i]['content'];
       		if(strstr($content,$search) == true){
       			$value[$i]['content'] = str_replace($search,$replace,$content);
       		}
       	}
       	$new_value = serialize($value);
   
       	echo 	'<hr><b>AFTER</b><br>'; print_r($value);
       	echo 	'<hr><b>SERIALIZED</b><br>'.$new_value;
   
       	$update = "update wpso_postmeta set <code>meta_value</code> = '".$new_value."' where <code>meta_id</code>= '".$data['meta_id']."'";
       	if($execute == 1){
       		echo '<hr color="green" size="2"><b>UPDATE QUERY</b><br>'.$update;
       		$mysqli->query($update);
       	}
       	echo '</div>';
       }
       ?>
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘phpMyAdmin: Export – Edit – Import’ is closed to new replies.

 * ![](https://ps.w.org/yikes-inc-easy-custom-woocommerce-product-tabs/assets/icon-
   256x256.png?rev=1558461)
 * [Custom Product Tabs for WooCommerce](https://wordpress.org/plugins/yikes-inc-easy-custom-woocommerce-product-tabs/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/yikes-inc-easy-custom-woocommerce-product-tabs/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/yikes-inc-easy-custom-woocommerce-product-tabs/)
 * [Active Topics](https://wordpress.org/support/plugin/yikes-inc-easy-custom-woocommerce-product-tabs/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/yikes-inc-easy-custom-woocommerce-product-tabs/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/yikes-inc-easy-custom-woocommerce-product-tabs/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [netstepinc](https://wordpress.org/support/users/netstepinc/)
 * Last activity: [6 years, 11 months ago](https://wordpress.org/support/topic/phpmyadmin-export-edit-import/#post-11651204)
 * Status: resolved