Hi,
I am trying to run a script, mentioned below, but keep getting the following error:
Fatal error: Call to a member function get_results() on a non-object
CAN SOMEONE please help with this error: I am at a lost and have had no response in posting this twice before.
thanks
Script is:
<div id="content" class="narrowcolumn">
<?php
global $wpdb;
$querystr = "
SELECT wposts.*
FROM $wpdb->posts wposts, wp_named_users
WHERE wposts.ID = wp_named_users.post_id
AND wp_named_users.user_id = '$current_user->ID'
AND wposts.post_type = 'post'
AND wposts.post_status = 'publish'
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; ?>
</div>