以下是引用hams在2010-11-19 14:40:05的发言:
这是我看到的最最复杂的条件搜索……
能不能简单点提供一下要判断的关键内容
比如:相关字段——类型
还有条件实例……
是一个会员生日提醒页面,按年提醒一次生日,但现在我想改成缴费提醒,就是每月的1号提醒,应该怎么改?源代码如下:
<%
if request.Cookies("shiwei_username")="" then
response.Redirect "login.asp"
end if
%>
<!-- #include file="../conn2.asp" -->
<!-- #include file="../const.asp" -->
<!-- #include file="../inc/function.asp" -->
<html>
<head>
<title>业主生日提醒</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../style/style.css" rel="stylesheet" type="text/css">
<style>body {background-color:#FFFFFF;}</style>
</HEAD>
<BODY>
<%
if request("hid")="ok" then
conn.execute("update yezhu set wenhou=#"&date()&"# where id="&request("id"))
end if
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#C4D8ED">
<tr>
<td><img src="../images/r_1.gif" alt="" /></td>
<td width="100%" background="../images/r_0.gif">
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td> 业主生日提醒</td>
<td align="right"> </td>
</tr>
</table>
</td>
<td><img src="../images/r_2.gif" alt="" /></td>
</tr>
<tr>
<td></td>
<td>
<table align="center" cellpadding="4" cellspacing="1" class="toptable grid" border="1" width="100%">
<tr align="center">
<td class="category" height="30">业主姓名</td>
<td class="category">房号</td>
<td class="category">电话</td>
<td class="category">住址</td>
<td class="category">生日</td>
<td class="category">操作</td>
</tr>
<%
sql="select * from yezhu where ((month(shengri)>="&month(date())&" and month(shengri)<="&month(date()+tiqian)&") and (day(shengri)>="&day(date())&" and day(shengri)<="&day(date()+tiqian)&") and year(wenhou)<>"&year(date())&" and yinyang='阳') or ((month(shengri)>="&WDateToEDate(now(),"1")&" and month(shengri)<="&WDateToEDate(now()+tiqian,"1")&") and (day(shengri)>="&WDateToEDate(now(),"2")&" and day(shengri)<="&WDateToEDate(now()+tiqian,"2")&") and year(wenhou)<>"&year(date())&" and yinyang='阴')"
'sql="select * from yezhu where (datediff('y','"&date()&"',shengri)>=0 and datediff('y','"&date()+tiqian&"',shengri)<=0 and yinyan='阳') or (datediff('y','"&WDateToEDate(now(),"1")&"',shengri)>=0 and datediff('y','"&WDateToEDate(now(),"1")+tiqian&"',shenri)<=0 and yinyang='阴')"
set rs=conn.execute(sql)
do while rs.eof=false
%>
<tr onMouseOver="this.className='highlight'" onMouseOut="this.className=''">
<td align=center height=25><%=rs("username")%></td>
<td align=center><%=rs("fanghao")%></td>
<td align=center><%=rs("tel")%></td>
<td align=center><%=rs("address")%></td>
<td align=center><%=rs("shengri")%> (<%=rs("yinyan")%>)</td>
<td align=center><input type=button value='已经问候,取消提醒' onclick=window.location.href='?hid=ok&id=<%=rs("id")%>' class="button"></td></tr>
<%
nowbaojing0=nowbaojing0&"ok"
rs.movenext
loop
%>
<%if nowbaojing0="" then%>
<tr onMouseOver="this.className='highlight'" onMouseOut="this.className=''">
<td align=center height=25 colspan="6" style="color:#ff0000">今天没有业主生日</td></tr>
<%end if%>
</table></td>
<td></td>
</tr>
<tr>
<td><img src="../images/r_4.gif" alt="" /></td>
<td></td>
<td><img src="../images/r_3.gif" alt="" /></td>
</tr></table></body></html>