OutFront Forums
     Home    Register     Search      Help      Login    

Sponsors
Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax
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.

Follow Us
On Facebook
On Twitter
RSS
Via Email

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

 

Hyperlink Query for Multiple Parameters

 
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, PHP, and Database >> Hyperlink Query for Multiple Parameters
Page: [1]
 
 
RickBDCR

 

Posts: 2
Joined: 2/20/2003
Status: offline

 
Hyperlink Query for Multiple Parameters - 2/20/2003 11:42:34   
I have a database that has a number of columns. The combination of fields used in a search varies with the type of product they are looking for. I like to pass the search parameters in a link but I cannot figure out how to have all searches use the same results page. Currently I need to create a new results page for every combination of parameters. For example, I have to customize a results page for the the three parameters in this search: http://www.datacenterresources.com/results7.asp?f1=Local Access&f2=Controls Multi-Platform&f4=Multi-user

I have tried setting the default values to % but when I do that I get no results. What I am doing works but I am up to 10 different results pages. I would really like to have a way to use just one that will work for all queries.
rdouglass

 

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

 
RE: Hyperlink Query for Multiple Parameters - 2/20/2003 12:14:21   
It sounds like you' re using the DRW.

I have done similar things with DRW. What I' ve done is first put the DRW on a Spooky Diet.

Then I build the SQL code ' on-the-fly' by determining if there is data in each of my fields. If there is data, add the query parameters. If not, skip it. Something like this:

<%
' Function to build query for search
Dim mySQL
mySQL = " "
If Request(" Field1" ) = " " then
mySQL = " "
else
mySQL = " (Field1 LIKE ' %::Field1::%' )"
end if
 
If Request(" Field2" ) > " " then
If mySQL = " " then
mySQL = " (Field2 LIKE ' %::Field2::%' )"
else
mySQL = mySQL & " AND (Field2 LIKE ' %::Field2::%' )"
end if
end if
 
If Request(" Field3" ) > " " then
If mySQL > " " then
mySQL = mySQL & " AND (Field3 LIKE ' %::Field3::%' )"
Else
mySQL = " (Field3 LIKE ' %::Field3::%' )"
End if
end if
 
' If query string is still blank, set a No Record Found value
If mySQL = " " then
mySQL = " (Field1 LIKE ' xxxx' )"
end if

%>

Then you replace the DRW fp_sQry line with something like:

fp_sQry=" SELECT * FROM myTable WHERE (" & mySQL &" )"

That' s just one way. There are others. Hope it helps...

(in reply to RickBDCR)
RickBDCR

 

Posts: 2
Joined: 2/20/2003
Status: offline

 
RE: Hyperlink Query for Multiple Parameters - 2/20/2003 16:24:18   
It worked perfectly. It will definitely make my life a little easier.

Thanks!

(in reply to RickBDCR)
box

 

Posts: 167
Joined: 12/10/2002
Status: offline

 
RE: Hyperlink Query for Multiple Parameters - 1/17/2008 12:28:54   
Hi rdouglass, in my case did not work! I want to have a form with one sinle text box that can search 3 fields homephone, cellphone, workphone and if find any match then disply I did follow your example but does not return any data and I use DRW! any idea thanks:)

(in reply to RickBDCR)
rdouglass

 

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

 
RE: Hyperlink Query for Multiple Parameters - 1/17/2008 12:46:06   
quote:

one sinle text box


Try making all the requests for the same field like this:

...WHERE ((homephone LIKE ' %::searchBox::%' ) OR (workphone LIKE ' %::searchBox::%') OR (cellphone LIKE ' %::searchBox::%' ))...

And be sure to use OR's if you want to search multiple fields (unless of course you really want all 3 fields to contain the number).

That help any?

_____________________________

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

ASP Checkbox Function Tutorial.

(in reply to box)
box

 

Posts: 167
Joined: 12/10/2002
Status: offline

 
RE: Hyperlink Query for Multiple Parameters - 1/17/2008 15:00:22   
Here is the code but it does not return any data:
fp_sQry="SELECT * FROM ptinfo WHERE ((homephone LIKE ' %::phone::%' ) OR (workphone LIKE ' %::phone::%') OR (cellphone LIKE ' %::phone::%' )) ORDER BY lastname ASC"

(in reply to rdouglass)
rdouglass

 

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

 
RE: Hyperlink Query for Multiple Parameters - 1/17/2008 15:04:44   
quote:

LIKE ' %::phone::%'


I might have some inadvertant space in there; see it? Just before the first %.

LIKE '%::phone::%'

I think it's in there on all 3. That any better?

_____________________________

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

ASP Checkbox Function Tutorial.

(in reply to box)
box

 

Posts: 167
Joined: 12/10/2002
Status: offline

 
RE: Hyperlink Query for Multiple Parameters - 1/17/2008 15:18:04   
Is working Thanks a lot...:)

< Message edited by box -- 1/17/2008 16:09:29 >

(in reply to rdouglass)
Page:   [1]

All Forums >> Web Development >> ASP, PHP, and Database >> Hyperlink Query for Multiple Parameters
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