Title: [Plugin: Shortcode Exec PHP] Including MySQL-Query destroys theme
Last modified: August 20, 2016

---

# [Plugin: Shortcode Exec PHP] Including MySQL-Query destroys theme

 *  Resolved Anonymous User 5580574
 * (@anonymized-5580574)
 * [15 years ago](https://wordpress.org/support/topic/plugin-shortcode-exec-php-including-mysql-query-destroys-theme/)
 * Hi there, at first thank you very much for this fantastic and necessary plugin!
   Actually everything works fine. ;D
 * Beneath other scripts I do include (via require_once) an external php-file with
   some variables and for one variable (the date) I ask the database to give me 
   the information and write it into the variable. For this db-query I add this:
 *     ```
       error_reporting (E_ALL);
       $connection = mysql_connect ("localhost","database", "password") or die ("no connection");
       mysql_select_db("table") or die ("doesnt exist");
       ```
   
 * Wenn I push the “test”-button in the plugin the results are correct (!). BUT 
   when I publish the article some other theme-parts (from other plugins) are broken.
   When I delete the 2nd line (mysql_select_db(“table”)), it works again (for sure
   without the date), but it works fine. So what’s the matter with the database-
   inclusion? What I made wrong? Or HOW to include some database-entries?
 * Thx+Regards
    Sebastian

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

 *  Plugin Contributor [M66B](https://wordpress.org/support/users/m66b/)
 * (@m66b)
 * [15 years ago](https://wordpress.org/support/topic/plugin-shortcode-exec-php-including-mysql-query-destroys-theme/#post-2084651)
 * I have no idea what is going wrong, but maybe you should try the [standard WordPress database functions](http://codex.wordpress.org/Function_Reference/wpdb_Class)
   to prevent interfering with the WordPress framework. Don’t forget to do a `global
   $wpdb;`.
 *  Thread Starter Anonymous User 5580574
 * (@anonymized-5580574)
 * [15 years ago](https://wordpress.org/support/topic/plugin-shortcode-exec-php-including-mysql-query-destroys-theme/#post-2084751)
 * I got it… As it’s [mentioned here](http://us.php.net/manual/de/function.mysql-connect.php#82040)
   you need to add a “TRUE” if you use the same connection.
 * So it should look like this (compare to code above):
 *     ```
       error_reporting (E_ALL);
       $connection = mysql_connect ("localhost","database", "password", TRUE) or die ("no connection");
       mysql_select_db("table") or die ("doesnt exist");
       ```
   
 * Topic resolved.

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

The topic ‘[Plugin: Shortcode Exec PHP] Including MySQL-Query destroys theme’ is
closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/shortcode-exec-php.svg)
 * [Shortcode Exec PHP](https://wordpress.org/plugins/shortcode-exec-php/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/shortcode-exec-php/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/shortcode-exec-php/)
 * [Active Topics](https://wordpress.org/support/plugin/shortcode-exec-php/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/shortcode-exec-php/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/shortcode-exec-php/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: Anonymous User 5580574
 * Last activity: [15 years ago](https://wordpress.org/support/topic/plugin-shortcode-exec-php-including-mysql-query-destroys-theme/#post-2084751)
 * Status: resolved