PDA

View Full Version : $sqlsortorder error


Boofo
03-08-2003, 12:44 PM
Can anyone please tell me why this code will work:

$threads=$DB_site->query("
SELECT $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,views,thread.iconid,not es,thread.visible,sticky,votetotal,attach,descript ion,slippery
FROM thread
".iif($foruminfo[allowicons],'LEFT JOIN icon ON (icon.iconid = thread.iconid)','')."
WHERE $threadids
ORDER BY RAND(NOW()), $sortfield $sqlsortorder
");

But this won't? Ity gives me the dreaded 1064 syntax error. I know it has to do the the $sqlsortorder. I want to be able to randomize the listing bit still have any sticky threads show up at the top.

$threads=$DB_site->query("
SELECT $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,views,thread.iconid,not es,thread.visible,sticky,votetotal,attach,descript ion,slippery
FROM thread
".iif($foruminfo[allowicons],'LEFT JOIN icon ON (icon.iconid = thread.iconid)','')."
WHERE $threadids
ORDER BY sticky RAND(NOW()) , $sortfield $sqlsortorder
");

Xenon
03-08-2003, 04:34 PM
you've forgotten a , between this:
sticky RAND(NOW())