The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Recent Posts Fetching Problem
Hi everyone!
My programmer setup this code to fetch the thread title and username of the latest 8 posts in the forum, but it's acting really weird. It's randomly showing different amounts of recent posts, from none to 3 to 6, when it should always show 8. And it's putting the incorrect thread title over the usernames. It's just acting really weird. Can anyone check out the below code and tell me if you notice anything that needs to be changed? Thanks so much for any help guys, Sean CODE: <?php $numberOfPosts = 8; $rs= mysql_query("SELECT postid, username, title, threadid FROM post ORDER BY dateline DESC LIMIT $numberOfPosts"); while ($row= mysql_fetch_array($rs)) { if ($row['title']=='') { $threadid= $row['threadid']; $rs2= mysql_query("SELECT title FROM post WHERE postid=$threadid LIMIT 1"); $row2= mysql_fetch_array($rs2); if ($row2 && $row2['title']) { $row['title']= $row2['title']; } else { continue; } } echo "<tr><td class='red10arial'><a class='whitetogray10' href='/forum/showthread.php?t={$row['threadid']}'>"; echo $row['title'].'</a><br/>'.$row['username'].''; echo '</td></tr>'; } ?> |
#2
|
|||
|
|||
[sql]
SELECT title FROM post WHERE postid=$threadid LIMIT 1[/sql] FROM post should be FROM thread (I think, or is it "threads" I'm not to sure) Also you can remove this: PHP Code:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|