Forum Moderators: coopster

Message Too Old, No Replies

Odd problem with selecting data

         

GGR_Web

1:18 pm on Sep 23, 2009 (gmt 0)

10+ Year Member



Using this script I pull the last three entries for a given catagory from a blog and display them.

It is being rolled out across our site and so far on 2 out of 3 areas I've put it on there's no problem.

In one place though the script is duplicating the content, at a point after $objectid is defined if my testing is good.

I think the error is somewhere inside the 2nd while loop but I can't see it.

<?php

mysql_select_db ('ggr_blog');

$wpbase = $site;

$wpcat = mysql_query ("SELECT * FROM wp_terms WHERE slug = '$wpbase' LIMIT 1 ");
while ($wpcatrow = mysql_fetch_array ($wpcat)) {
$wpcatid = $wpcatrow['term_id'];

}

$object = mysql_query ("SELECT * FROM wp_term_relationships WHERE term_taxonomy_id = '$wpcatid' LIMIT 3");
while ($objectrow = mysql_fetch_array($object)) {
$objectid = $objectrow['object_id'];

//done
$posts = mysql_query ("SELECT * FROM wp_posts WHERE ID = '$objectid' LIMIT 3");
$postsrow = mysql_fetch_array ($posts);
echo '<p>'. $postsrow['post_title']. '<br>';
echo '<a href="'. $postsrow['guid']. '">Read More...</a></p>';
}
?>

GGR_Web

1:27 pm on Sep 23, 2009 (gmt 0)

10+ Year Member



Problem just cleared itself. Don't think I did anything.
:confused

andrewsmd

1:53 pm on Sep 23, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That just happens some times.