POST_INFO.asp
'############################ Poll Mod ##############################
if Request.Form("poll") = "1" then
strSql = "SELECT " & strTablePrefix & "TOPICS.TOPIC_ID "
strSql = strSql & "FROM " & strTablePrefix & "TOPICS "
strSql = strSql & "WHERE " & strTablePrefix & "TOPICS.T_ISPOLL = " & 1 & " "
strSql = strSql & "ORDER BY " & strTablePrefix & "TOPICS.T_DATE DESC"
set rsPollID = my_Conn.Execute (strSql)
PollID = rsPollID("TOPIC_ID")
rsPollID.close
set rsPollID = nothing
'## Forum_SQL - Add new poll to Polls Table
strSql = "INSERT INTO " & strTablePrefix & "POLLS (CAT_ID"
strSql = strSql & ", FORUM_ID"
strSql = strSql & ", TOPIC_ID"
strSql = strSql & ", P_WHOVOTES"
'for i = 1 to ubound(txtAns)
' strSql = strSql & ", ANSWER" & CStr(i)
' strSql = strSql & ", COUNT" & CStr(i)
'next
strSql = strSql & ") VALUES ("
strSql = strSql & Cat_ID
strSql = strSql & ", " & Forum_ID
strSql = strSql & ", " & PollID
strSql = strSql & ", '" & chkString(Request.Form("WhoVotes"),"SQLString") & "'"
'for i = 1 to ubound(txtAns)
' strSql = strSql & ", '" & chkString(txtAns(i),"") & "'"
' strSql = strSql & ", " & 0
'next
strSql = strSql & ")"
strSql = strSql & ""
For i=1 to UBound(txtAns)
if Trim(txtAns(i)) <> "" Then
strSql = strSql & ";INSERT INTO " & strTablePrefix & "POLL_ANSWERS (POLL_ID, ANSWER_TEXT, ANSWER_ORDER, ANSWER_COUNT) VALUES ("
strSql = strSql & PollID & ", '" & chkString(txtAns(i),"SQLString") & "'," & i & ", " & 0 & ")"
Else
exit for
End If
next
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
end if
'####################################################################
Also in POST_INFO.ASP
'############################ Poll Mod ###################################
if Request.Form("poll") = "1" then
'### Update poll answers and counts
strSql = "SELECT ANSWER_COUNT FROM " & strTablePrefix & "POLL_ANSWERS WHERE POLL_ID=" & Topic_ID & " ORDER BY ANSWER_ORDER ASC"
set rs=my_Conn.Execute(strSql)
if not rs.EOF Then
tumPolls = rs.GetRows
toplamPAnswers = UBound(tumPolls,2) + 1
Else
toplamPAnswers = 0
End If
rs.Close
set rs=nothing
strSql = "UPDATE " & strTablePrefix & "POLLS "
strSql = strSql & " SET P_WHOVOTES = '" & chkString(Request.Form("WhoVotes"),"SQLString") & "', "
strSql = strSql & " CAT_ID = " & cLng(aryForum(0)) & ", "
strSql = strSql & " FORUM_ID = " & cLng(aryForum(1)) & " "
'for i = 1 to CInt(Request.Form("count"))
' strSql = strSql & "ANSWER" & CStr(i) & " = '" & chkString(txtAns(i),"") & "'"
' if txtAns(i) = "" or chkString(Request.Form("resetpoll"),"SQLString") = "1" then
' strSql = strSql & ", COUNT" & CStr(i) & " = " & 0
' end if
' if ubound(txtAns) <> i then
' strSql = strSql & ", "
' end if
'next
strSql = strSql & " WHERE TOPIC_ID = " & Topic_ID
my_Conn.Execute(strSql),,adCmdText + adExecuteNoRecords
strSQL = "DELETE FROM " & strTablePrefix & "POLL_ANSWERS WHERE POLL_ID = " & Topic_ID
my_Conn.Execute(strSQL)
strSQL = ""
for i=1 to CInt(Request.Form("count"))
if Trim(chkString(txtAns(i),"")) <> "" Then
strSQL = strSQL & "INSERT INTO " & strTablePrefix & "POLL_ANSWERS (POLL_ID, ANSWER_TEXT, ANSWER_ORDER, ANSWER_COUNT) VALUES ("
strSQL = strSQL & Topic_ID & ", "
strSQL = strSQL & "'" & chkString(txtAns(i),"SQLString") & "', "
strSQL = strSQL & i & ","
if chkString(Request.Form("resetpoll"),"SQLString") = "1" then
strSQL = strSQL & 0
Else
if i <= toplamPAnswers Then
z = i-1
strSQL = strSQL & tumPolls(0,z)
Else
strSQL = strSQL & 0
End If
End If
Else
Exit for
End If
strSql = strSql & ");"
next
my_Conn.Execute(strSql),,adCmdText + adExecuteNoRecords
if Request.Form("resetpoll") = "1" then
'### Delete poll votes from POLL_VOTES table for this topic
strSql = "DELETE FROM " & strTablePrefix & "POLL_VOTES "
strSql = strSql & "WHERE " & strTablePrefix & "POLL_VOTES.TOPIC_ID = " & Topic_ID
my_Conn.Execute(strSql),,adCmdText + adExecuteNoRecords
end if
end if
'#########################################################################