Output configuration script

liunx

Guest
Hi y'all, I'm using a select and group sql statement to output some categories to an asp page (I'm using classic asp, not .net). Each record has a primary key, title, and category. Here's the basics of the sql statement:

SELECT [Category] FROM YourTable GROUP BY [Category]

The output looks like this:
Cat 1
Cat 2
Cat 3
etc

I'd like to get asp to make each displayed category into a hyperlink, that then selects all records that belong to that category (and I don't know how).

Anyone out there got some info I can either try or research?

Hope I've made this understandable!

TIA!In the output code use the usual hyperlink code with a variable on the end to store the selected category:

<a href=http://www.htmlforums.com/archive/index.php/"yourpage.asp?cat=<%=Category%>"><%=Category%></a>

On the next page retrieve this value from the URL, store it in a variable and then use that for your select statement to pull in all records for the chosen category:

strCategory = request.querystring("cat")

SQL "SELECT * FROM YourTable WHERE Category='" & strCategory & "'"Thanks Goldilocks, I'll have a crack at it!Alrighty then. Being a complete biff, I've tried to follow the instructions as best I can, but I get the following msg displayed from the code I'm using:

Microsoft VBScript compilation error- Error '800a0409'

Unterminated string constant

/comm_select.asp, line 39

Response.Write ("<a href='http://www.htmlforums.com/archive/index.php/comm_test.asp?cat=<%=Category

Doing some googling makes me suspect that I'm missing some " or ' characters, but I'll be buggered if I know from where. I've added a whole fruit salad of punctuation to the code, but asp just sits there laughing.

Here's the actual code I'm using:


Response.Write ("<a href='http://www.htmlforums.com/archive/index.php/comm_test.asp?cat=<%=Category%>' target='newsframe'>")
Response.Write ("<%=Category%>")
Response.Write ("</a><br>")

If I change the <%=Category%> to (rsDB("Category")), I actually get the effect I'm after for the first page, but then it all falls apart as soon as I click on one of the links, so I'd like to know if I'm actually doing anything right before messing with that.

TIA.You need to esacpe the quotes using double set of double quotes, vb treats it as a literal. and

com_.asp?x="" & var & "">"
 
Back
Top