Quote:
Originally Posted by MrNase
Hello,
We discussed that topic a bit at vbulletin ( http://www.vbulletin.com/forum/showthread.php?t=118083) and now I'd like to have something like that.
I don't think it's a large problem to display the thumbnail of an attached image on forumdisplay.php but Iam just searching for a way to randomly display an image.. Most of the threads have 3 or even more images (the members are using the threads to publish pictures) and i'd like to display them randomly. Is there a way to add this function directly to the query or do I need some special code to generate a random ID with which I can pull it of the database and display it.
Here's a basic SQL Query which wouldn't work (obviously  ) but which should give you an impression of what I want:
SELECT random(id) FROM attachment WHERE threadid = $threadid LIMIT 1;
In this case there is more than just one result because there are 3 or more images attached to that thread but I just want to have one random entry out of the 3.
I hope you get what I mean and I hope you can help me 
|
If you can capture the attachment id's of the new thread and store them in thread table when it gets submitted you should be able to elimate a query at least, i thnk