<% set my_conn= Server.CreateObject("ADODB.Connection") set rs = Server.CreateObject("ADODB.Recordset") my_Conn.Open ConnString Function FormatStr(String) on Error resume next String = Replace(String, CHR(13), "") String = Replace(String, CHR(10) & CHR(10), "

") String = Replace(String, CHR(10), "
") FormatStr = String End Function If Request.QueryString("mode") = "doit" then if Request.Form("search") <> "" then ' Build Nightmare SQL Statement - Kill Server!!! keywords = split(Request.Form("search"), " ") keycnt = ubound(keywords) StrSql ="SELECT Forum.*, Reply.*, Topics.* FROM (Forum LEFT JOIN Topics " StrSql = StrSQl & "ON Forum.Forum_ID = Topics.Forum_id) LEFT JOIN Reply ON Topics.Topic_ID = Reply.Topic_ID " StrSQl = StrSql & "WHERE " if Request.Form("forum") <> 0 then StrSql = StrSql & "Forum.Forum_ID = " & Request.Form("forum") & " and " End If StrSQL = StrSql & "(" if Request.Form("searchdate") <> 0 then dt = cint(Request.Form("searchdate")) StrSql = StrSql & "T_date > #" & dateadd("d", -dt, now) & "#) and (" End if cnt = 0 For Each word in keywords StrSql =StrSql & "Forum.F_Description Like '%" & word & "%' or Reply.R_Message Like '%" StrSql =StrSql & word & "%' or Topics.T_Message Like '%" StrSql =StrSql & word & "%' " if cnt < keycnt then StrSql = StrSql & Request.Form("andor") cnt = cnt + 1 next StrSql =StrSql & ") order by topics.topic_id" mypage=request("whichpage") If mypage="" then mypage=1 end if rs.Open StrSql, my_Conn, 3,1 'response.write (StrSql) If rs.Eof or rs.Bof then ' No categories found in DB Response.Write "No se enocantraron resultados" Else %> <% rec_id="" do until rs.Eof '## Display Forum 'response.write rs("f_name") if rec_id = rs("Topics.topic_ID") then ' Don't do anything Else Response.Write "" Response.Write "" Response.Write "" Response.Write "" End if rec_id = rs("Topics.topic_id") rs.MoveNext loop %>
" Response.Write "" & rs("T_Subject") & "" & rs("T_date") & "" & rs("F_Name") & "

<% End If Else ' Search = "" %>

Debe ingresar palabras mas precisas

<% Response.End End if ' Search = "" Else %>

Buscar por :
Que esten todas estas palabras
Que encuentre una de estas palabras
En Foro :
Por fecha :
<% End If on error resume next set rs = nothing my_conn.Close set my_conn = nothing %>