Title: External database connection
Last modified: August 21, 2016

---

# External database connection

 *  [mppatil211](https://wordpress.org/support/users/mppatil211/)
 * (@mppatil211)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/external-database-connection/)
 * I am developing a wordpress plugin that connects to external database,
    fetch
   data, and displays it on metabox below page/post editor. I used following code:
 * /** MySQL hostname */
    define(‘EXT_DB_HOST’, ‘removed’);
 * /** MySQL database name */
    define(‘EXT_DB_NAME’, ‘removed’);
 * <?php
    /** MySQL database username */ define(‘EXT_DB_USER’, ‘removed’);
 * /** MySQL database password */
    define(‘EXT_DB_PASSWORD’, ”);
 * /** MySql table prefix */
    define(‘TABLE_PREFIX’,’removed’); $new_db=”; $new_wpdb
   =new WPDB(EXT_DB_USER, EXT_DB_PASSWORD, EXT_DB_NAME, EXT_DB_HOST); ?> saved this
   file as wp-db-config.php
 * included this file in constructor of main plugin class and
    I used ajax for fetching
   data. The data is shown in metabax below editor in both posts and page. I got
   success in adding, getting, deleting, updating data.
 * The main problem arise is that I cant update or create new post and page.
    I 
   googled this problem but I didnt get solution. Please help me out of this problem

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

 *  [Josh](https://wordpress.org/support/users/josh401/)
 * (@josh401)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/external-database-connection/#post-4516985)
 * Most likely the hook you are using. It’s probably running too early.. which is
   preventing the rest of the normal WP functionality to complete.
 * Use pastebin.com, and show me the code you are working with. Specifically, the
   code of how you are connecting to this database and displaying it’s contents.
 *  Thread Starter [mppatil211](https://wordpress.org/support/users/mppatil211/)
 * (@mppatil211)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/external-database-connection/#post-4517018)
 * Check this link
    [http://pastebin.com/8XEA7vf1](http://pastebin.com/8XEA7vf1)
   for code

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

The topic ‘External database connection’ is closed to new replies.

## Tags

 * [external database](https://wordpress.org/support/topic-tag/external-database/)
 * [metabox](https://wordpress.org/support/topic-tag/metabox/)
 * [page](https://wordpress.org/support/topic-tag/page/)
 * [posts](https://wordpress.org/support/topic-tag/posts/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [mppatil211](https://wordpress.org/support/users/mppatil211/)
 * Last activity: [12 years, 4 months ago](https://wordpress.org/support/topic/external-database-connection/#post-4517018)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
