📄 search.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/gym.asp" -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>场地查询</title>
<style type="text/css">
<!--
@import url("style.css");
-->
</style>
</head>
<%
set_ground=request.Form("set_ground")
set_cost=request.Form("set_cost")
%>
<body>
<div align="center">
<table width="706" height="281" border="0" class="table_big">
<tr>
<td valign="top"><div align="center">
<!--#include file="inc/head.asp" -->
<br>
<form name="form1" method="post" action="">
<table width="533" border="0" class="table_small">
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2" class="text_title"><div align="left">请给出查询条件:</div></td>
</tr>
<tr>
<td colspan="2" class="table_title"> </td>
</tr>
<tr>
<td colspan="2" class="text"><div align="left">
<p>查看所有费用上限
<select name="set_cost" class="select_filed2" id="set_cost">
<option selected>不作要求</option>
<option>5元</option>
<option>10元</option>
<option>15元</option>
<option>30元</option>
<option>30元以上</option>
</select>
的
<select name="set_ground" class="select_filed2" id="set_ground">
<option selected>所有</option>
<option>足球</option>
<option>篮球</option>
<option>排球</option>
<option>羽毛球</option>
<option>乒乓球</option>
<option>网球</option>
<option>游泳池</option>
</select>
场地</p>
</div></td>
</tr>
<tr>
<td width="341" class="text"> </td>
<td width="121" class="text"><div align="center">
<input name="search" type="submit" class="button_" id="search" value="查询">
</div></td>
</tr>
</table>
</form>
<%
if set_ground="" and set_cost="" then
response.End()
else
%>
<%
set rs_search=server.CreateObject("adodb.recordset")
sql = "select * from ground "
'如果输入查询条件,构造where结构-----------
if not (set_cost = "不作要求" and set_ground = "所有" )then
sql = sql & "where "
end if
if set_ground <> "所有" then
sql = sql & "type = '" & set_ground & "'"
end if
if set_cost <> "不作要求" and set_ground <> "所有" then
sql = sql & " and "
end if
if set_cost = "5元" then
sql = sql & "cost <= 5"
elseif set_cost = "10元" then
sql = sql & "cost <= 10"
elseif set_cost = "15元" then
sql = sql & "cost <= 15"
elseif set_cost = "30元" then
sql = sql & "cost <= 30"
elseif set_cost = "30元以上" then
sql = sql & "cost > 30"
end if
'调试时加入的语句用来查看生成的sql命令---------------
'response.Write(sql)
'打开场地数据库---------------
rs_search.open sql,gym_conn,3,2
if rs_search.eof or rs_search.bof then
searchok=0
else
searchok=1
end if
%>
<table width="533" border="0" class="table_small">
<tr>
<td colspan="4"> </td>
</tr>
<tr>
<td colspan="4" class="text_title"><div align="left">查询结果:
<%
if searchok=1 then
response.Write("查看所有开放于"& set_time &"的"& set_ground &"场地,费用上限"& set_cost)
end if
%>
</div></td>
</tr>
<tr>
<td colspan="4" class="table_title"> </td>
</tr>
<% If searchok=0 Then %>
<tr>
<td colspan="4" class="text_error"><div align="left">●没有找到符合要求的场地</div></td>
</tr>
<% Else %>
<tr class="text_title">
<td width="145"><div align="left">场地名称</div></td>
<td width="112"><div align="left">场地类型</a></div></td>
<td width="136"><div align="left">费用(元/小时)</div></td>
<td width="118"><div align="left">开放时间</div></td>
</tr>
<%
rs_search.movefirst
while (not rs_search.eof)
%>
<tr class="text">
<% urltext="preengage.asp?ground_id="& rs_search("ground_id") %>
<td><div align="left"><a href="<%= urltext %>"><%= rs_search("name") %></a></div></td>
<td><div align="left"><%= rs_search("type") %></div></td>
<td><div align="left"><%= rs_search("cost") %></div></td>
<td><div align="left">8:00-20:00</div></td>
</tr>
<%
rs_search.movenext
Wend
%>
<tr>
<td colspan="4" class="text"> </td>
</tr>
<tr>
<td colspan="4" class="text"><div align="left">●点击场地名称可以直接预约该场地<br>
</div></td>
</tr>
<% End If %>
<tr>
<td colspan="4"> </td>
</tr>
</table>
<br>
<!--#include file="inc/foot.asp" -->
<br>
</div></td>
</tr>
</table>
</div>
<% End If %>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -