Title: [Plugin: Shortcode Exec PHP] Error messages &#8211; how to interpret
Last modified: August 20, 2016

---

# [Plugin: Shortcode Exec PHP] Error messages – how to interpret

 *  Resolved [Jeff M.](https://wordpress.org/support/users/fenfan/)
 * (@fenfan)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-shortcode-exec-php-error-messages-how-to-interpret/)
 * Hello, again!
 * Take a look at the following post:
 * [PDATA Test](http://onebostonfan.com/2012/04/01/pdata-test/)
 * Any clue as to why I am getting error messages? The shortcode appears to be executing
   properly.
 * [http://wordpress.org/extend/plugins/shortcode-exec-php/](http://wordpress.org/extend/plugins/shortcode-exec-php/)

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

 *  Plugin Contributor [M66B](https://wordpress.org/support/users/m66b/)
 * (@m66b)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-shortcode-exec-php-error-messages-how-to-interpret/#post-2662258)
 * Since you didn’t post the code, I can only guess. ‘mysql_real_escape_string’ 
   needs an open database connection to work (which is indeed a little counter-intuitive).
 *  Thread Starter [Jeff M.](https://wordpress.org/support/users/fenfan/)
 * (@fenfan)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-shortcode-exec-php-error-messages-how-to-interpret/#post-2662261)
 * Here is the code:
 *     ```
       extract(shortcode_atts(array('arg' => 'default'), $atts));
   
       $playerID = $arg;
   
       $dbbosfan = mysql_connect ("localhost", USERNAME, PASSWORD);
       if (!$dbbosfan){
       	die ('I cannot connect to the database because: ' . mysql_error());
       }
   
       mysql_select_db ("bosfan_redsox",$dbbosfan);
   
       $query = "SELECT * FROM playerdata pd WHERE pd.playerID = '$playerID'";
       $result = mysql_query($query,$dbbosfan) or die(mysql_error());
       $row = mysql_fetch_array($result);
   
       $p_name = $row['fullname'];
       $p_byy = $row['byy'];
       $p_bmm = $row['bmm2'];
       $p_bdd = $row['bdd'];
       $p_posID = $row['posID'];
       $p_pos = $row['pos'];
   
       $p_legend = FALSE;
       if ($row['legend'] == TRUE){
       	$p_legend = TRUE;
       }
   
       $p_soxhof = FALSE;
       if ($row['soxhof'] == TRUE){
       	$p_soxhof = TRUE;
       	$p_soxhofyear = $row['soxhofyear'];
       }
   
       $p_bbhof = FALSE;
       if ($row['bbhof'] == TRUE){
       	$p_bbhof = TRUE;
       	$p_bbhofyear = $row['bbhofyear'];
       }
   
       mysql_close($dbbosfan);
   
       print "  <p><strong>Date of Birth</strong>: ".$p_bdd." ".$p_bmm." ".$p_byy."<br/>\n";
   
       if ($p_soxhof = TRUE){
         print "    <strong>Elected to Red Sox Hall of Fame</strong>: ".$p_soxhofyear."<br/>\n";
       }
   
       if ($p_bbhof = TRUE){
         print "    <strong>Elected to Baseball Hall of Fame</strong>: ".$p_bbhofyear."<br/>\n";
       }
   
       print "  </p>\n\n";
       ```
   
 *  Plugin Contributor [M66B](https://wordpress.org/support/users/m66b/)
 * (@m66b)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-shortcode-exec-php-error-messages-how-to-interpret/#post-2662263)
 * _Warning: mysql\_real\_escape\_string(): 14 is not a valid MySQL-Link resource
   in /home/bosfan/public\_html/onebostonfan/wp-includes/wp-db.php on line 787_
 * Warning: mysql_error(): 14 is not a valid MySQL-Link resource in /home/bosfan/
   public_html/onebostonfan/wp-includes/wp-db.php on line 1098
 * It seems these errors are not related to the shortcode, look at the file names.
 *  Thread Starter [Jeff M.](https://wordpress.org/support/users/fenfan/)
 * (@fenfan)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-shortcode-exec-php-error-messages-how-to-interpret/#post-2662267)
 * Resolved it… apparently, it did not like the use of the mysql_close() fuction.
 *  Thread Starter [Jeff M.](https://wordpress.org/support/users/fenfan/)
 * (@fenfan)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-shortcode-exec-php-error-messages-how-to-interpret/#post-2662294)
 * So now when I remove the mysql_close() function, some of the other WP-specific
   widgets do not function. For example, on this page:
 * [PDATA Test Page](http://onebostonfan.com/pdata-test-page/)
 * The script runs, but then the sidebar widgets for the Categories and Tags show
   no output.
 * My guess is that the opening of the SQL database separate from the QP SQL database
   is the culprit.
 *  Plugin Contributor [M66B](https://wordpress.org/support/users/m66b/)
 * (@m66b)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-shortcode-exec-php-error-messages-how-to-interpret/#post-2662296)
 * Is the database you are using in the script the WordPress database? If so, you
   should use the [WordPress functions](http://codex.wordpress.org/Class_Reference/wpdb)
   to access it.
 *  Thread Starter [Jeff M.](https://wordpress.org/support/users/fenfan/)
 * (@fenfan)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-shortcode-exec-php-error-messages-how-to-interpret/#post-2662297)
 * No, it’s a separate database.
 *  Plugin Contributor [M66B](https://wordpress.org/support/users/m66b/)
 * (@m66b)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-shortcode-exec-php-error-messages-how-to-interpret/#post-2662298)
 * Maybe you should re-select the WordPress database at the end of the script (mysql_select_db).
 *  Thread Starter [Jeff M.](https://wordpress.org/support/users/fenfan/)
 * (@fenfan)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-shortcode-exec-php-error-messages-how-to-interpret/#post-2662338)
 * Bingo! Thanks again, Marcel.

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

The topic ‘[Plugin: Shortcode Exec PHP] Error messages – how to interpret’ 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/)

 * 9 replies
 * 2 participants
 * Last reply from: [Jeff M.](https://wordpress.org/support/users/fenfan/)
 * Last activity: [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-shortcode-exec-php-error-messages-how-to-interpret/#post-2662338)
 * Status: resolved