<?php
require_once "../include/function.php";(替换成conn.asp)
$lmfrom = $_GET['from'];
$fromdt = $_GET['fromdt'];
$todt = $_GET['todt'];
if(!empty($fromdt) && !empty($todt))
{
$sql = "select * from web_user where lmfrom='$lmfrom' and regtime>='$fromdt' and regtime<='$todt' and lmzt=2 order by id asc";
}
else
{
$sql = "select * from web_user where lmfrom='$lmfrom' and lmzt=2 order by id asc";
}
$re = mssql_query($sql);
while($rs = mssql_fetch_object($re))
{
echo '会员ID:'.$rs->lmuid.',注册时间:'.$rs->regtime.',来访IP:'.$rs->lmip.',状态:'.成功."<br>\n";
}
?>

解决方案 »

  1.   

    <!--#include file="../include/conn.asp"-->
    <%
    set rs = Server.CreateObject("ADODB.Recordset")
    lmfrom = Request.QueryString("from")
    fromdt = Request.QueryString("fromdt")
    todt = Request.QueryString("todt")
    If lmfrom <> "" and todt <> "" Then
    sql = "select * from web_user where lmfrom='$lmfrom' and regtime>='$fromdt' and regtime <='$todt' and lmzt=2 order by id asc"; 
    else
    $sql = "select * from web_user where lmfrom='$lmfrom' and lmzt=2 order by id asc"; 
    end if
    rs.Open sql,1,1while not rs.eof
    Response.Write("会员ID:"&rs("lmuid")&", 注册时间:"&rs("regtime")&" 来访IP:"&rs("lmip")&" 状态:成功<br>")
    rs.movenext
    wend
    %>
      

  2.   

    SQL语句我没改你自己改一下
    这段代码也没测试
      

  3.   

    sql = "select * from web_user where lmfrom='"&lmfrom&"'  and regtime>='"&fromdt&"' and regtime <='"&$todt&"' and lmzt=2 order by id asc"
    $sql = "select * from web_user where lmfrom='"&lmfrom&"' and lmzt=2 order by id asc"
    SQL语句 
      

  4.   

    sql = "select * from web_user where lmfrom='"&lmfrom&"'  and regtime>='"&fromdt&"' and regtime <='"&todt&"' and lmzt=2 order by id asc" 
    $sql = "select * from web_user where lmfrom='"&lmfrom&"' and lmzt=2 order by id asc" 上面的多了个$
      

  5.   

    <!--#include file="../include/function.php"-->
    <%lmfrom = Request.QueryString("from") 
    fromdt = Request.QueryString("fromdt") 
    todt = Request.QueryString("todt") 
    if not empty(fromdt) and not empty(todt) then sql = "select * from web_user where lmfrom='"&lmfrom&"' and regtime>='"&fromdt&"' and regtime <='"&todt&"' and lmzt=2 order by id asc"else $sql = "select * from web_user where lmfrom='"&lmfrom&"' and lmzt=2 order by id asc"end if
    set rs = Server.CreateObject("adodb.recordset")
    rs.open sql,conn,1,1
    while not rs.eofResponse.write "会员ID:"&rs("lmuid")&",注册时间:"&rs("regtime")&",来访IP:"&rs("lmip")&",状态:"&rs("成功")&" <br>"&vbcrlf rs.movenext
    wend
    rs.close
    %>
    注意的是,PHP里的“;”一定要去掉
      

  6.   


    <!--#include file="../include/conn.asp"-->
    <%
    Dim lmfrom,fromdt,todt,Rs,sql
    lmfrom = Trim(Request.QueryString("from")) 
    fromdt = Trim(Request.QueryString("fromdt")) 
    todt   = Trim(Request.QueryString("todt")) if fromdt="" or todt="" then  
        sql = "select * from web_user where lmfrom='"&lmfrom&"' and regtime>='"&fromdt&"' and regtime <='"&todt"&' and lmzt=2 order by id asc" 
    else 
        sql = "select * from web_user where lmfrom='"&lmfrom&"' and lmzt=2 order by id asc" 
    End ifSet Rs = Conn.Execute(sql)
    Do while not Rs.eof 
           Response.write "会员ID:"&Rs("lmuid")&",注册时间:"&Rs("regtime")&",来访IP:"&Rs("lmip")&",状态:成功 <br>" 
    Rs.MoveNext
    Loop
    Rs.Close
    Set  Rs = Nothing 
    %>最好是先定义,再使用,数据集开启最后必须关闭和清空
      

  7.   

    不好意思,看错了,我写的if和else反了
      

  8.   


    HTML code<!--#include file="../include/conn.asp"-->
    <%
    Dim lmfrom,fromdt,todt,Rs,sql
    lmfrom = Trim(Request.QueryString("from")) 
    fromdt = Trim(Request.QueryString("fromdt")) 
    todt   = Trim(Request.QueryString("todt")) 
    if not empty(fromdt) and not empty(todt)then
        sql="select * from web_user where lmfrom='"&lmfrom&"' and regtime>='"&fromdt&"' and regtime <='"&todt&"' and lmzt=2 order by id asc"
    else 
    $sql="select * from web_user where lmfrom='"&lmfrom&"' and lmzt=2 order by id asc"
    end if
    set rs= Server.CreateObject("adodb.recordset")
    rs.open sql,conn,1,1
    whilenot rs.eof
    Response.write"会员ID:"&rs("lmuid")&",注册时间:"&rs("regtime")&",来访IP:"&rs("lmip")&",状态:"&rs("成功")&" <br>"&vbcrlf rs.movenextwend
    rs.close%>