|
|
_ответ
@form.local[]
^server[;
^context[ip;
^sql[select count(*)
from IIS_QuestResult (nolock), IIS_QuestAnswer (nolock)
where (IIS_QuestAnswer.Quest_ID=(select MAX(Quest_ID)
from IIS_Quest (nolock)
where IIS_Quest.Quest_Finish is Null)) and
(IIS_QuestResult.QuestAnswer_ID=IIS_QuestAnswer.QuestAnswer_ID) and
(IIS_QuestResult.QuestResult_IP='^env[REMOTE_ADDR]')]
]
]
/Та часть ищет содержится ли IP в БД и если да то отображаются результаты голосования, если нет, то форма/
^eq[^item[ip;0];0;
^server[;
^context[quest_name;
^sql[select Quest_Body, Quest_ID from IIS_Quest (nolock)
where (IIS_Quest.Quest_ID=(select MAX(N.Quest_ID)
from IIS_Quest as N (nolock)
))
]
]
^context[quest_answ;
^sql[select QuestAnswer_Body, QuestAnswer_ID from IIS_QuestAnswer (nolock)
where (IIS_QuestAnswer.Quest_ID=(select MAX(N.Quest_ID)
from IIS_Quest as N (nolock))
)
]
]
]
<form method=post>
<input type=hidden name=doInsert value=1>
<table border="0" cellspacing="0" cellpadding="0" width=154>
<tr>
<td rowspan="9"><IMG height=1 src="" width=5></td>
<td colspan="2" valign="TOP"><B>^item[quest_name;0]</B><br><br></td>
</tr>
^context[quest_answ;
^menu[
<tr>
<td width="5%" valign="TOP"><INPUT type=radio value=^item[1] name=vote></td>
<td colspan="2">^item[0]</TD>
</TR>
]
]
<tr height=8>
<td></td>
</tr>
<TR height=3>
<TD></TD>
<TD></TD>
</TR>
<TR>
<TD></TD>
<td colspan="2"><input type=image src="i/send_g.gif" value="Отправить"></TD>
</TR>
</table>
</form>
;
^server[;
^ifdef[^form[doInsert];
^context[temp;
^sql[insert into IIS_QuestResult (
QuestAnswer_ID,
QuestResult_IP
) values (
'^number[vote]',
'^env[REMOTE_ADDR]'
)]
]
]
^context[quest;
^sql[
select Quest_Body from IIS_Quest
where Quest_ID=(select MAX(Quest_ID)
from IIS_Quest (nolock)
where IIS_Quest.Quest_Finish is Null)
]
]
^context[quest_answw;
^sql[select IIS_QuestAnswer.QuestAnswer_ID,
IIS_QuestAnswer.QuestAnswer_Body,
count(IIS_QuestResult.QuestResult_ID) as AnswerCount,
(100* count(IIS_QuestResult.QuestResult_ID)/(
select count(R.QuestResult_ID)
from IIS_QuestAnswer as A (nolock), IIS_QuestResult as R (nolock)
where (A.Quest_ID=(select MAX(Quest_ID)
from IIS_Quest (nolock)
where IIS_Quest.Quest_Finish is Null)) and
(R.QuestAnswer_ID=A.QuestAnswer_ID)
)) as AnswerPercent,
(select count(R2.QuestResult_ID)
from IIS_QuestAnswer as A2 (nolock), IIS_QuestResult as R2 (nolock)
where (A2.Quest_ID=(select MAX(Quest_ID)
from IIS_Quest (nolock)
where IIS_Quest.Quest_Finish is Null)) and
(R2.QuestAnswer_ID=A2.QuestAnswer_ID)
) as AnswerTotal
from IIS_QuestAnswer (nolock), IIS_QuestResult (nolock)
where (IIS_QuestAnswer.Quest_ID=(select MAX(Quest_ID)
from IIS_Quest (nolock)
where IIS_Quest.Quest_Finish is Null)) and
(IIS_QuestResult.QuestAnswer_ID=IIS_QuestAnswer.QuestAnswer_ID)
group by IIS_QuestAnswer.QuestAnswer_ID, IIS_QuestAnswer.QuestAnswer_Body]
<table width="154">
<tr>
<td colspan="2" align="CENTER"><b>^item[quest;0]</b></td>
</tr>
^menu[
<tr>
<td colspan="2"><img src="../i/quad_3.gif" width=4 height=8 border=0 alt=""> ^item[1]</td>
</tr>
<tr>
<td width="5%"><font size="-2">^item[3]%</font></td><td align="LEFT"><img src="i/color.gif" width=^item[3] height=7 border=0 alt=""></td>
</tr>
]
<tr>
<td colspan="2" align="RIGHT"><b>Всего:</b> ^item[4] чел.</td>
</tr>
</table>
]
]
] Проблема в том, что действительно, если IP есть в БД, что отображаются результаты голосования, но форма перестала отправлять результаты в БД. Почему?
|