Mitrofan
05-27-2001, 08:30 PM
I made a small hack that puts a X number of links to latest polls in the forum.
It could be forther fine tuned to specify which forums to include, in my case I need the latest polls from all forums.
It can be used on non-VB page like home page.
Here is tha code.<?
require("forums/admin/config.php");
$db=mysql_connect($servername,$dbusername,$dbpassw ord);
mysql_select_db($dbname);
$mypollselect = "select threadid, title, pollid, lastpost, replycount, views FROM thread where pollid!=0 ORDER BY lastpost DESC LIMIT 5";
$pollresult = mysql_query($mypollselect);
if ($row = mysql_fetch_array($pollresult)) {
do {
printf("<br><FONT FACE=\"Verdana, Arial, Helvetica, sans-serif\" SIZE=\"1\"><a href=\"http://www.yoururl.com/forums/showthread.php?threadid=%d\"><b>%s</b></a><br><FONT FACE=\"Verdana, Arial, Helvetica, sans-serif\" SIZE=\"1\"> %d views - %d replies</font>", $row[threadid], $row[title], $row[views], $row[replycount]);
} while ($row = mysql_fetch_array($pollresult));
}
?>
It shows links to latest 5 polls with number of replies and number of views.
I want to add the number of votes also, but just don't know how to do that.
I think I know how to add the number of votes when I only put a link to one latest poll, but don't know how to do the same with the list of X number of polls.
Please someone help me. It should be easy for any php programmer, which I am not.
It could be forther fine tuned to specify which forums to include, in my case I need the latest polls from all forums.
It can be used on non-VB page like home page.
Here is tha code.<?
require("forums/admin/config.php");
$db=mysql_connect($servername,$dbusername,$dbpassw ord);
mysql_select_db($dbname);
$mypollselect = "select threadid, title, pollid, lastpost, replycount, views FROM thread where pollid!=0 ORDER BY lastpost DESC LIMIT 5";
$pollresult = mysql_query($mypollselect);
if ($row = mysql_fetch_array($pollresult)) {
do {
printf("<br><FONT FACE=\"Verdana, Arial, Helvetica, sans-serif\" SIZE=\"1\"><a href=\"http://www.yoururl.com/forums/showthread.php?threadid=%d\"><b>%s</b></a><br><FONT FACE=\"Verdana, Arial, Helvetica, sans-serif\" SIZE=\"1\"> %d views - %d replies</font>", $row[threadid], $row[title], $row[views], $row[replycount]);
} while ($row = mysql_fetch_array($pollresult));
}
?>
It shows links to latest 5 polls with number of replies and number of views.
I want to add the number of votes also, but just don't know how to do that.
I think I know how to add the number of votes when I only put a link to one latest poll, but don't know how to do the same with the list of X number of polls.
Please someone help me. It should be easy for any php programmer, which I am not.