Hi everyone, I'm trying to modify the sql string below to pull two new fields called 'Address2' and 'Address3' from a table called 'User'. The join between the users table and the thread table would be:
thread.postuserid = user.userid
This sql string is the code that builds the threads on all vBulletin
forums(just like here at PHP Builder)
$threads=$DB_site->query("
SELECT $dotuserid $votequery ".iif($foruminfo[allowicons],'icon.title as icontitle,icon.iconpath,','')."
thread.threadid,thread.title,lastpost, forumid,pollid,open,replycount,postusername,postuserid,
lastposter,thread.dateline,views,thread.iconid,notes,thread.visible,sticky,votetotal,attach
FROM thread
".iif($foruminfo[allowicons],'LEFT JOIN icon ON (icon.iconid =
thread.iconid)','')."
$dotjoin
WHERE $threadids
ORDER BY sticky DESC, $sortfield $sqlsortorder
");
In the code above:
$dotjoin = "LEFT JOIN post ON (thread.threadid = post.threadid AND post.userid = '$bbuserinfo[userid]' AND post.visible = 1)";
Thanks for any help on this.