DbPress – Configurations
- Article
- Comment
Thank you for choosing my Plugin to play with another Database(db). I hope you will like it. Because Here I used to create another Object ( $kvdb) for your second database. There are some bugs and problem in it. I am working to get you a bug free plugin. Let’s see the conditions and informations before using it.
- If you enter a wrong User name, host, db nam, and password, it will leads you to disturb your core WordPress and you cant use it further. So be sure with the db details before providing in it.
- There some limited features are working. Becasue I just created the plugin for my own project. So I am working with it Side by side. Hopefully I will come up with a complete one.
- Dont try to edit my library files ” kvdb.php ” and ” dbpress.php” Becuase if you try to edit it Few features will not work for you.
Some of the information’s, how to handle these plugin.
- Just install and activate the plugin
- just declare a global variable/Object $kvdb and use it.
- With the help of the plugin you can do some functions which are listed below.
Functions And Usage :
- Create table,
- insert, delete, update, get results.
- More similar functions like the core$ wpdb. If you encounter any problem or bug, please feel free to comment below.
Sample Codes :
global $kvdb ; $test_table = $kvdb->prefix.'kv_test_table'; $sql_query = "CREATE TABLE IF NOT EXISTS $test_table ( `id` int(11) NOT NULL AUTO_INCREMENT, `person_name` varchar(64) NOT NULL default '', `contact_no` varchar(128) NOT NULL default '', `email` varchar(15) NOT NULL default '', UNIQUE KEY id (id) )ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;"; dbDelta($sql_query);
The above code helps you to create a new table in your new database.
Likewise you query and get results from the second table,
$users = $kvdb->get_results( "SELECT * FROM kv_custom_table"); foreach ( $users as $user ) { echo $user->username; }
You can do much more.
***If your site stuck with database error use the following troubleshoot steps.
If your site is messed all because of the DbPress Plugin . do the following steps to get it back.
- Just move to your PHPMyAdmin and open the database , which you installed WordPress,
- Than open, wp_options table, may the prefix of the table is different. So open the options table and use the following query to remove the fields,
DELETE FROM `wp_options` WHERE `option_name` = 'kv_db_host' DELETE FROM `wp_options` WHERE `option_name` = 'kv_db_name' DELETE FROM `wp_options` WHERE `option_name` = 'kv_db_user' DELETE FROM `wp_options` WHERE `option_name` = 'kv_db_user_pass'
Execute all the queries one by one. Than move to your wordpress, it will work now.
If you cant use the above query, than find the following four items from the table an delete it Manually,
kv_db_user_pass
kv_db_user
kv_db_name
kv_db_host.
That’s it.