then I get a ambious error on dateline
====
$getthreadids=$DB_site->query("
SELECT
".iif($sortfield=="voteavg",$votequery,"")."
thread.threadid
FROM thread
WHERE thread.forumid = $foruminfo[forumid]
AND thread.sticky=0
AND thread.visible=1
$datecut
$limitothers
ORDER BY sticky DESC, $sortfield $sqlsortorder
LIMIT ".($sel_limitlower-1).",$perpage");
$threadids='thread.threadid IN (0';
while ($thread=$DB_site->fetch_array($getthreadids)) {
$threadids .= "," . $thread['threadid'];
}
if ($stickyids != '') {
$threadids .= $stickyids;
}
$threadids.=')';
$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,postus erid,
lastposter,thread.dateline AS threadstart,views,thread.iconid,notes,thread.visib le,sticky,votetotal,attach
FROM thread
".iif($foruminfo[allowicons],'LEFT JOIN icon ON (icon.iconid = thread.iconid)','')."
$dotjoin
WHERE $threadids
ORDER BY sticky DESC, threadstart $sqlsortorder
");
======
Weird thing is that I can't change $sortfield to
threadstart because then I get another type of sql error, table not know.
I got it working now with the way above, and removed all sorting options from the templates.
|