Title: Querying an Additional Database for Shortcode Values
Last modified: August 20, 2016

---

# Querying an Additional Database for Shortcode Values

 *  [cbreit](https://wordpress.org/support/users/cbreit/)
 * (@cbreit)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/querying-an-additional-database-for-shortcode-values/)
 * Hello Everyone,
 * I am looking to query an additional database with a plugin that will pull out
   values and assign them to short codes. What I have built is currently working
   beautifully, but I want to make sure this thing doesn’t blow up in my face. I
   have added the code below and I was hoping I could get some confirmation that
   what I have done will continue to work.
 *     ```
       $con = mysql_connect("HOST","USERNAME","PASSWORD");
   
       if (!$con){
           die('Could not connect: ' . mysql_error());
       }
   
       mysql_select_db("DB_NAME", $con);
       mysql_set_charset('utf8',$con);
   
       function regContentGetterv3(){
           $regQ = "SELECT post_content FROM wp_posts WHERE post_title='$_GET[wver]' ORDER BY ID DESC LIMIT 0,1";
           $regQBOOM = mysql_query($regQ);
           $regContent = mysql_result($regQBOOM, 0);
           return $regContent;
       }
       add_shortcode('regcontentcodev3', 'regContentGetterv3');
       ```
   

The topic ‘Querying an Additional Database for Shortcode Values’ is closed to new
replies.

## Tags

 * [mysql_connect](https://wordpress.org/support/topic-tag/mysql_connect/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [cbreit](https://wordpress.org/support/users/cbreit/)
 * Last activity: [13 years, 6 months ago](https://wordpress.org/support/topic/querying-an-additional-database-for-shortcode-values/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
