• Resolved sam888

    (@sam888)


    Hi

    been getting the following error in trying to run a script to join two tables in my database : wp_named_users and wp_posts. the internal join is through the post_id column in each table.

    the error is as follows:

    WordPress database error: [Table ‘turtle64_wordpress.wp_named_userswnamed_users’ doesn’t exist]
    SELECT wposts.* FROM wp_posts wposts, wp_named_userswnamed_users WHERE wposts.ID = wnamed_users.post_id AND wnamed_users.user_id = ‘.user’ AND wposts.post_status = ‘publish’ AND wposts.post_type = ‘post’ AND wposts.post_date < NOW() ORDER BY wposts.post_date DESC

    the script is as follows:

    <div id=”content” class=”narrowcolumn”>

    <?php

    $querystr = “
    SELECT wposts.*
    FROM $wpdb->posts wposts, $wpdb->prefix” . named_users . “wnamed_users
    WHERE wposts.ID = wnamed_users.post_id
    AND wnamed_users.user_id = ‘$current.user’
    AND wposts.post_status = ‘publish’
    AND wposts.post_type = ‘post’
    AND wposts.post_date < NOW()
    ORDER BY wposts.post_date DESC
    “;

    $pageposts = $wpdb->get_results($querystr, OBJECT);

    ?>
    <?php if ($pageposts): ?>
    <?php foreach ($pageposts as $post): ?>
    <?php setup_postdata($post); ?>

    <div class=”post” id=”post-<?php the_ID(); ?>”>
    <h2>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”>
    <?php the_title(); ?>
    </h2>
    <small><?php the_time(‘F jS, Y’) ?> <!– by <?php the_author() ?> –></small>
    <div class=”entry”>
    <?php the_content(‘Read the rest of this entry ?’); ?>
    </div>

    <p class=”postmetadata”>Posted in <?php the_category(‘, ‘) ?> | <?php edit_post_link(‘Edit’, ”, ‘ | ‘); ?>
    <?php comments_popup_link(‘No Comments ?’, ‘1 Comment ?’, ‘% Comments ?’); ?></p>
    </div>
    <?php endforeach; ?>

    <?php else : ?>
    <h2 class=”center”>Not Found</h2>
    <p class=”center”>Sorry, but you are looking for something that isn’t here.</p>
    <?php include (TEMPLATEPATH . “/searchform.php”); ?>
    <?php endif; ?>

    which ever way I try to reference wp_named_users in the script, it doesnt seem to accept it.

    please can someone help.

    thks

    Sam

  • The topic ‘Database Error !!!!’ is closed to new replies.