$result = $db->sql_query("SELECT pollID, pollTitle, timeStamp, artid FROM ".$prefix."_poll_desc WHERE pollID='$pollID'");
$holdtitle = $db->sql_fetchrow($result);
echo "<b>$holdtitle[1]</b><br><br>";
$i = intval($i);
for($i = 0; $i < 12; $i++) {
$result2 = sql_query("SELECT optionCount FROM ".$prefix."_poll_data WHERE pollID='$pollID' AND voteID='$i'", $dbi);
$object = sql_fetch_object($result2, $dbi);
$optionCount = $object->optionCount;
$sum = (int)$sum+$optionCount;
}
echo "<table border=\"0\">";
/* cycle through all options */
for($i = 1; $i <= 12; $i++) {
/* select next vote option */
$result3 = sql_query("SELECT pollID, optionText, optionCount, voteID FROM ".$prefix."_poll_data WHERE pollID='$pollID' AND voteID='$i'", $dbi);
$object = sql_fetch_object($result3, $dbi);
if(is_object($object)) {
$optionText = $object->optionText;
$optionCount = $object->optionCount;
if($optionText != "") {
echo "<tr><td>";
echo "$optionText";
echo "</td>";
if($sum) {
$percent = 100 * $optionCount / $sum;
} else {
$percent = 0;
}
echo "<td>";
$percentInt = (int)$percent * 4 * 1;
$percent2 = (int)$percent;
if(is_user($user)) {
if($cookie[9]=="") $cookie[9]=$Default_Theme;
if(!$file=@opendir("themes/$cookie[9]")) {
$ThemeSel = $Default_Theme;
} else {
$ThemeSel = $cookie[9];
}
} else {
$ThemeSel = $Default_Theme;
}
if (file_exists("themes/$ThemeSel/images/survey_leftbar.gif") AND file_exists("themes/$ThemeSel/images/survey_mainbar.gif") AND file_exists("themes/$ThemeSel/images/survey_rightbar.gif")) {