一表里有固定的编码每个编码对应一个积分
字段code fd6656k
fen 50
就是说输入一个表里面固定的代码就可以得到积分啊
<% If request.Form("code")<>""Then
session("code")=request.form("code")
set rs=Server.CreateObject("adodb.recordset")
sql="select code from [Tab_code] where code='"&session("code")&"'"
rs.open sql,conn,1,3
if rs.eof then
response.write "你输入的代码不正确"
response.end()
else
sql="select code from Tab_code where integral='"&integral&"'"
response.write sql
response.end()
end if
end if %>
<table width="300" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="55"><form id="form1" name="form1" method="post" action="">
<label>
<input name="code" type="text" id="code" />
</label>
<label>
<input type="submit" name="Submit" value="积分" />
</label>
</form> </td>
<td> </td>
</tr>
</table>
參考答案:sql="select code from Tab_code where integral='"&integral&"'"
response.write sql
response.end()
你输出sql做什么?没明白!
sql="select code from Tab_code where integral='"&integral&"'"
'你的integral哪来的哦?!
获得积分并且写到数据库就是
if rs.eof then
response.write "<script>alert('你输入的代码不正确')</script>"
response.end()
else
sql="select * from Tab_code where code = '"&session(code)&"' "
rs.open sql,conn,1,2
rs("fen")=request.form("fen")
rs.update
response.write "<script>alert('积分得到啦~!')</script>"
response.end()