WordPress.org

Support

Support » How-To and Troubleshooting » WP looks for wrong database

WP looks for wrong database

  • 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?

Viewing 5 replies - 1 through 5 (of 5 total)
  • 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.

    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

    help! 🙁

    pixelpp
    Member

    @pixelpp

    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.

    Joshua Sigar
    Member

    @alphaoide

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

    $wpdb->select(DB_NAME)

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘WP looks for wrong database’ is closed to new replies.