navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
FrontPage Alternative
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Free FrontPage Templates

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

needing AND OR for a search criteria

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> needing AND OR for a search criteria
Page: [1]
 
sleepers

 

Posts: 38
Joined: 7/24/2007
Status: offline

 
needing AND OR for a search criteria - 8/23/2007 2:12:20   

HI, i have a view of records that i can use a drop down to get the venue only to show or the Act - but how can i get it to do AND OR

SO i have a search form with two dropdowns at the top

if i dropdown select a venue it will load the venue search
if i dropdown select an act it will list the act shows

but if i dropdown select both venue and act i want to be able to see the search with both of those criteria

This is what i have in the form now


s-sql="SELECT * FROM Results WHERE (Venue = '::Venue::') AND (Act = '::Act::') ORDER BY [Date] ASC"
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: needing AND OR for a search criteria - 8/23/2007 10:04:19   
Checkout my post in this thread. I think it should work for you as well:

http://www.frontpagewebmaster.com/m-113131/tm.htm#113148

Hope it helps.

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to sleepers)
sleepers

 

Posts: 38
Joined: 7/24/2007
Status: offline

 
urgent::needing AND OR for a search criteria - 8/23/2007 19:36:12   
i though i had dieted and inserted the code as described in the post below but i cant get it to work can someone please help me



this is the search page... BOLD is the code i amended and inserted

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Paul</title>
</head>
<%DIM myQuerystring 

myQuerystring = " " 

IF Request.Form("venue" ) > " a" THEN 
myQuerystring = " (venue = ' " & IF Request.Form("venue" ) & " ' )" 
END IF 

IF Request.Form("ACT" ) > " a" THEN 

' check to see if myQuerystring has anything in it 
IF myQuerystring > " a" THEN 
myQuerystring = myQuerystring & " AND " 
END IF 

myQuerystring = myQuerystring & " (ACT= ' " & IF Request.Form("ACT" ) & " ' )" 
END IF 

%>  
<body bgcolor="#000000">
<p><b><font size="6" color="#FFFFFF" face="Arial">Venue/Act Lookup </font></b>
<font face="Arial"><br>
</font>
<form BOTID="2" METHOD="POST" ACTION="viewvenue2.asp">
  <nobr><font face="Arial">
  <!--#include file="_fpclass/fpdblib.inc"-->
<%
fp_sQry="SELECT * FROM Results WHERE " & myQuerystring ORDER BY [Date] ASC"
fp_sDefault=""
fp_sNoRecords="No records returned."
fp_sDataConn="add_venue"
fp_iMaxRecords=0
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=True
fp_sMenuChoice="T1"
fp_sMenuValue="T1"
fp_iDisplayCols=1
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>

  <select NAME="venue" SIZE="1" tabindex="8">

    <!--#include file="_fpclass/fpdbrgn1.inc"-->

    <option><%=FP_FieldHTML(fp_rs,"T1")%></option>

    <!--#include file="_fpclass/fpdbrgn2.inc"-->
 
  </select>  </font> </nobr>
  <p><font color="#FFFFFF" face="Arial"><nobr>
        <!--#include file="_fpclass/fpdblib.inc"-->
<%
fp_sQry="SELECT * FROM Results WHERE " & myQuerystring ORDER BY [Date] ASC"
fp_sDefault=""
fp_sNoRecords="No records returned."
fp_sDataConn="add_act"
fp_iMaxRecords=0
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=True
fp_sMenuChoice="ACT"
fp_sMenuValue="ACT"
fp_iDisplayCols=1
fp_fCustomQuery=False
BOTID=1
fp_iRegion=BOTID
%>

        <select NAME="ACT" SIZE="1" tabindex="9">

          <!--#include file="_fpclass/fpdbrgn1.inc"-->
          <option><%=FP_FieldHTML(fp_rs,"ACT")%></option>
          <!--#include file="_fpclass/fpdbrgn2.inc"-->
        </select></nobr></font><nobr><font face="Arial"> <br>
   </font> </nobr>
  <font face="Arial"><br>
  <input TYPE="Submit"><input TYPE="Reset">
  </font>
  </p>
</form>
<table border="1">
  <thead>
    <tr>
      <td bgcolor="#FFFFFF"><b><font face="Arial" size="1">ID</font></b></td>
      <td bgcolor="#FFFFFF"><b><font face="Arial" size="1">Status</font></b></td>
      <td bgcolor="#FFFFFF"><b><font face="Arial" size="1">Date</font></b></td>
      <td bgcolor="#FFFFFF"><b><font face="Arial" size="1">Venue</font></b></td>
      <td bgcolor="#FFFFFF"><b><font face="Arial" size="1">Act</font></b></td>
      <td bgcolor="#FFFFFF"><b><font face="Arial" size="1">Fee1</font></b></td>
      <td bgcolor="#FFFFFF"><b><font face="Arial" size="1">GST1</font></b></td>
      <td bgcolor="#FFFFFF"><b><font face="Arial" size="1">Payment</font></b></td>
      <td bgcolor="#FFFFFF"><b><font face="Arial" size="1">Vs</font></b></td>
      <td bgcolor="#FFFFFF"><b><font face="Arial" size="1">Start</font></b></td>
      <td bgcolor="#FFFFFF"><b><font face="Arial" size="1">Finish</font></b></td>
    </tr>
  </thead>
  <tbody>
 <!--#include file="_fpclass/fpdblib.inc"-->




<%
fp_sQry="SELECT * FROM Results WHERE " & myQuerystring ORDER BY [Date] ASC"
fp_sDefault="Venue="
fp_sNoRecords="<tr><td colspan=15 align=left width=""100%"">No records returned.</td></tr>"
fp_sDataConn="form"
fp_iMaxRecords=0
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_iDisplayCols=15
fp_fCustomQuery=False
BOTID=2
fp_iRegion=BOTID
%>
<!--#include file="_fpclass/fpdbrgn1.inc"-->

    <tr>
      <td bgcolor="#FFFFFF"><font face="Arial" size="1"><%=FP_FieldVal(fp_rs,"ID")%>
        </font></td>
      <td bgcolor="#FFFFFF"><font face="Arial" size="1"><%=FP_FieldVal(fp_rs,"Status")%>
        </font></td>
      <td bgcolor="#FFFFFF"><font face="Arial" size="1"><%=FP_FieldVal(fp_rs,"Date")%>
        </font></td>
      <td bgcolor="#FFFFFF"><font face="Arial" size="1"><%=FP_FieldVal(fp_rs,"Venue")%>
        </font></td>
      <td bgcolor="#FFFFFF"><font face="Arial" size="1"><%=FP_FieldVal(fp_rs,"Act")%>
        </font></td>
      <td bgcolor="#FFFFFF"><font face="Arial" size="1"><%=FP_FieldVal(fp_rs,"Fee1")%>
        </font></td>
      <td bgcolor="#FFFFFF"><font face="Arial" size="1"><%=FP_FieldVal(fp_rs,"GST1")%>
        </font></td>
      <td bgcolor="#FFFFFF"><font face="Arial" size="1"><%=FP_FieldVal(fp_rs,"Payment")%>
        </font></td>
      <td bgcolor="#FFFFFF"><font face="Arial" size="1"><%=FP_FieldVal(fp_rs,"Vs")%>
        </font></td>
      <td bgcolor="#FFFFFF"><font face="Arial" size="1"><%=FP_FieldVal(fp_rs,"Start")%>
        </font></td>
      <td bgcolor="#FFFFFF"><font face="Arial" size="1"><%=FP_FieldVal(fp_rs,"Finish")%>
        </font></td>
    </tr>
   
    <!--#include file="_fpclass/fpdbrgn2.inc"-->

  </tbody>
</table>

</body>

</html>

(in reply to rdouglass)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: urgent::needing AND OR for a search criteria - 8/27/2007 8:30:31   
quote:

fp_sQry="SELECT * FROM Results WHERE " & myQuerystring ORDER BY [Date] ASC"


Try that line this way:

fp_sQry="SELECT * FROM Results WHERE " & myQuerystring & "ORDER BY [Date] ASC"

See what's missing?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to sleepers)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> needing AND OR for a search criteria
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts