Hi,
Yea that put it back into order .. ie threads 25,26,27,28,29 ..
For some reason the variable $title is been missed out totally ..
Here is a explination of what I am trying to acheive .. Im close with what I have in the query .. But its not quite right ..
I am trying to pull out the 5 most recent threads from vbulletin and the lastest post from each thread .. within a loop .. ie display x5:
Posted by: Topic: Views: Replys:
$postername $title $views $replycount
Last Poster:
$lastposter $pagetext
Here is the structure from the two tables I am trying to join:
vb3_thread
threadid | title | firstpostid | lastpost | forumid | pollid | open | replycount | postusername | postuserid | lastposter | dateline | views | iconid | notes visible | sticky | votenum | votetotal | attach | similar
vb3_post
postid | threadid | parentid | username | userid | title | dateline | pagetext allowsmilie | showsignature | ipaddress | iconid | visible | attach
The query I have so far is:
Code: Select all
$sql = "SELECT * FROM vb3_thread LEFT JOIN vb3_post ON vb3_thread.threadid = vb3_post.threadid WHERE vb3_thread.lastposter = vb3_post.username GROUP BY vb3_thread.threadid ORDER BY vb3_thread.threadid DESC LIMIT 5";
$result = mysql_query($sql) or die ("Query failed");
while ($row = mysql_fetch_array($result)) {
$threadid = $row['threadid'];
$title = $row['title'];
$replycount = $row['replycount'];
$postusername = $row['postusername'];
$lastposter = $row['lastposter'];
$dateline = $row['dateline'];
$views = $row['views'];
$username = $row['username'];
$pagetext = $row['pagetext'];
Any help is greatly appreciated ..
Thanks