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.phpincluded 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
- The topic ‘External database connection’ is closed to new replies.