Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

QueryString Help in DWMX 1

Status
Not open for further replies.

LearningAndEarning

Technical User
Feb 18, 2005
11
US
I am having a problem in DWMX with querystrings. I have a page on the web site I am working on ( called Browse Books on this page are links for searching by category, language etc. I am URL Encoding these links and sending them to results pages. The results pages contain the SQL code to accept the URL links.

Problem is I can only seem to get a single query per results page. I don't want to have to create 30+ pages for this browse page. In the SQL Statement Builder in DWMX I am using Variables to decode the URL the run time value would be for example Request.QueryString("Art") "Art" being the encoded value from the browse page. This works fine with only one variable decoded per page, but when I try to do multiple decodes the results start coming back almost randomly.

Here's an example of what is being put in the SQL builder:

SELECT* FROM tblBooks WHERE (Category1 = 'mmColParam' OR Category2 = 'mmColParam') OR (Category1 = 'mmColParam2' OR Category3 = 'mmColParam2')

Any suggestions as to what I am doing wrong?
 
Whats your search form look like and what are your db columns that you are searching on?

Cheech

[Peace][Pipe]
 
I am not using a form I'm using a link which looks like this:

<a href="/art_results.asp?Art=<%=Server.URLEncode("Art")%>">Art</a>

Then I am decoding it on the results page using a variable. Which is:

Request.QueryString("Art")

This works fine if you want to only return 1 category to 1 results page. Problem is is that if you look at the web site there are like 20 something different categories to choose from. I don't want to make an individual page for each. I would also perfer not to use a form with a list or drop down menu on it which is how I originally had it set up.

Hope this information helps,

Thanks
 
ok make your links
Code:
<a href="/art_results.asp?cat=<%=Server.URLEncode("Art")%>">Art</a>
[/code]
then your result page would have
Code:
searchCat = Request.Querystring("cat")

That will work for a single search criterea. If you wish to allow multiple category searches then you will have to submit a form with checkboxes for each category & then I would build the SELECT statement in a loop something like
Code:
<% dim num
dim req_cat
dim whr
dim sql
whr=""
req_cat=split(request.querystring("cat"),",",-1,1)
for each num in req_cat
if whr<>"" then whr=whr & " or "
whr=whr & "cat=" & num
next
sql="SELECT * FROM dbPosts WHERE "
sql=sql & whr
%>

If you wanted to get real clever you could still have your links on the first page, but instead of them being href's you could update a hidden form field with their values and when the user submits their search this value is used to do your select. But thats a whole diff javascript solution.

Cheech



[Peace][Pipe]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top