Title: mysql_close issue
Last modified: August 20, 2016

---

# mysql_close issue

 *  [Dubai Web Design – incirclemedia.com](https://wordpress.org/support/users/incirclemedia/)
 * (@incirclemedia)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/mysql_close-issue-1/)
 * I have two wp installed on my server, one is my website and 2nd is blog. I want
   to display two recent posts from blog to website through bellow code.
 * It is working perfect but I think mysql_close() is making issue to close database.
   because I am calling footer of my website but it is showing posts from blog. 
   But on inner pages it is displaying website footer.
 * How can i fix it?
 *     ```
       <?php
       	$db_username = '#######';
       	$db_password = '#######';
       	$db_database = '#######';  
   
       	$blog_url = 'http://www.#######.com/#######/blog/'; //base folder for the blog. Make SURE there is a slash at the end  
   
       	//connect to the database
       	$con = mysql_connect(localhost, $db_username, $db_password);
       	@mysql_select_db($db_database) or die("Unable to select database");
       	$query = "Select * FROM wp_posts WHERE post_type='post' AND post_status='publish' ORDER BY id DESC LIMIT 2";
   
       	$query_result = mysql_query($query);  
   
       	while($row = mysql_fetch_array($query_result))
           {
           ?>
   
           <div class="blog_cont"> <a>"><b><?php echo $row['post_title'] ?></b></a><br clear="all" />
             <span><?php if (strlen($row['post_content']) > 40) { echo substr($row['post_content'], 0, 120) . '...'; } ?></span> <a>">Read More »</a> </div>
           <?php }
       	  @mysql_close($con);
       	?>
       ```
   

The topic ‘mysql_close issue’ is closed to new replies.

## Tags

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

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 0 replies
 * 1 participant
 * Last reply from: [Dubai Web Design – incirclemedia.com](https://wordpress.org/support/users/incirclemedia/)
 * Last activity: [13 years, 5 months ago](https://wordpress.org/support/topic/mysql_close-issue-1/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
