WordPress.org

Ready to get started?Download WordPress

Forums

WP looks for wrong database (6 posts)

  1. keen
    Member
    Posted 8 years ago #

    I have a database called site_blog for my wordpress and another one, site_referers, for the logging of my referers. Now when I include the log.php from the referer-script into the header to enable logging, wordpress tries to reach its tables through the referer's database and errors like these occur throughout the page:

    [Table 'site_referrers.wp_posts' doesn't exist]
    WordPress database error: [Table 'site_referrers.wp_options' doesn't exist]

    how does that happen?

  2. niziol
    Member
    Posted 8 years ago #

    Perhaps posting a link and/or some of the code (using http://pastebin.ca or a similar service) that's in question and the version of WP you're using may help someone to figure this out with you.

    Good luck,
    Michael.

  3. keen
    Member
    Posted 8 years ago #

    okay, I use 1.5.2 of WP...

    here is the log.php I call via
    <?php include_once('/home/site/public_html/log.php'); ?>
    http://pastebin.ca/42590

    and here is the DB info it uses to connect
    http://pastebin.ca/42591

  4. keen
    Member
    Posted 8 years ago #

    help! :(

  5. pixelpp
    Member
    Posted 7 years ago #

    Hello,
    I had the EXACT same problem with my site (tamworthbaptist.org.au). I generate the navigation dynamically, and I also have a members database that I check to see if someone is logged in, well this was causing this issue particular, fortunately, I was able to create a condition that would only check the member database when it was on the members page (not the WordPress page's).

    This defiantly sounds like a bug, WordPress is not SELECT -ing the database table every time it needed information, but surprisingly, the post excerpt worked, so it obviously is possible to have two database calls on one page, its just WordPress needs to be select the right table all the time.

  6. Joshua Sigar
    Member
    Posted 7 years ago #

    Maybe you just need to execute the following after executing your other scripts

    $wpdb->select(DB_NAME)

Topic Closed

This topic has been closed to new replies.

About this Topic