Error establishing a database connection problem in xampp saver

WP-CONFIG file should be like below- // ** MySQL settings – You can get this info from your web host ** // /** The name of the database for WordPress */ define(‘DB_NAME’, ‘database_name_here’); /** MySQL database username */ define(‘DB_USER’, ‘username_here’); /** MySQL database password */ define(‘DB_PASSWORD’, ‘password_here’); /** MySQL hostname */ define(‘DB_HOST’, ‘localhost’); /** Database … Read more

Historic WordPress database connection

WordPress still has mysql_query() in its codebase (as of February 27, 2018). mysql_*() was deprecated in PHP 5.5.0 and removed in PHP 7.0.0. Since WordPress still supports PHP 5.2 (for reasons beyond understanding), it needs to support both mysql_*() and mysqli_*(), WordPress will use mysqli_query() when available ( PHP > 5.3.0 ) and fallback to … Read more

Remove a shortcode from all WordPress posts

I love to use this tool, Search and Replace for WordPress Databases. It is basically a PHP script that is written for WordPress usage (but of course can be used with any database). When placed in the WordPress project, it automatically detects and loads the Database using data from wp-config.php file. It enables you to … Read more

How to create multiple database tables on plugin activation?

Why only the second? Because dbDelta() supports CREATE TABLE table_name format only. I.e. Exactly “CREATE TABLE” followed by (one space and) the table name. More specifically, dbDelta() uses this regular expression pattern: CREATE TABLE ([^ ]*) when parsing the queries into an array indexed by the table name; i.e. array( ‘table_1’ => ‘query’, ‘table_2’ => … Read more

Not connecting to database in file with multiple MySQL connections

When you include wp-load.php, WordPress will load wp-config.php, where constants with the same identifiers you have chosen here are already defined. This should be throwing warnings regarding the duplicate definition. Because you cannot re-define constants, the values you are attempting to set in this file are ignored. Choose different names for them if they are … Read more

Accessing two databases wordpress

When enhancing WordPress functionality, always use the theme’s functions.php file (located, generally, in {WP root}/wp-content/themes/{your theme}/functions.php), or put your code into a plugin. The rules for hacking core code are similar to the rules for optimization. Don’t do it. (for experts only) Don’t do it yet.