I've got a primary site at www.mydomain.com. I've got a wordpress blog setup at www.mydomain.com/blog. I would like site visitors to my primary site to determine the three recent blogs. I could accomplish it easily while using following code:

<?php    
define('WP_USE_THEMES', false);
require('/home/mydomain/public_html/blog/wp-load.php');
query_posts('showposts=3');
?>

<?php while (have_posts()) : the_post(); ?>
      <div class='category rounded_box'>
        <?php if ( get_post_meta($post->ID, 'image', true) ) { ?>
        <div class="category-thumbnail">
            <a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><img src="<?php bloginfo('template_directory'); ?>/scripts/timthumb.php?src=<?php echo get_post_meta($post->ID, "image", $single = true); ?>&h=100&w=100&zc=1" width="100" height="100" border="0" /></a>
        </div>
        <?php } ?>
        <div class='category_title'>
            <h2><a href='<?php the_permalink() ?>'><?php the_title(); ?></a></h2>
        </div>
        <div class='duration_home'>
            <?php the_excerpt(); ?>
            <span>Posted on <?php the_time('F jS, Y') ?> - <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></span>
        </div>
      </div>
      <?php endwhile;?>

<?php
wp_reset_query();
?>

Problem now's, anything around the page that needs calling a table for that primary site no more works. I am getting a mistake saying it's searching for your table within the Wordpress blogs database.

How do you break the bond towards the Wordpress database?

Thanks!

EDIT: SOLVED!

I needed to close the mysql connection, after which soon after connect with my primary database table. This is exactly what I put into the finish from the code:

mysql_close();
include "scripts/connect_to_mysql.php";

I understand you fixed your problem, however, for future reference you need to define each connection object whenever using multiple connections. In case your primary database is on a single mysql server then you definitely should have the ability to perform a mysql_choose_db($dbname) once you run the wordpress code rather than closing and reopening the bond. For multiple connections stick to the information out of this answer: How do you connect to multiple MySQL databases on a single webpage?