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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do you create an SQL variable from a link

Status
Not open for further replies.

gavray

Programmer
Jul 17, 2000
65
GB
Hi hope there's someone who understands what I mean,

for example,

The links hear in this very forum are pulled from a database, when you clicked on my subject query, it sent you to this bigger page with the message. How did they do that?

In my database I've got the name of bands with their songs, When I use a drop box with styles of music and the person clicks e.g rock it displays all the bands with the style rock. But suppose someone wanted to go the actual bands page from what was response written in the html page . I obviously don't want to create an individual page for each band when I could use a variable. But how would I take the name of the band displayed and place it in a variable.

there's no real explanations i can find elsewhere, probably because i don't know what the technique is called

please, suggestions appreciated

Gav
[sig][/sig]
 
Gav,

When you write out the name of the band, add a querystring to the URL e.g.
Code:
<a href = &quot;showBandDetail.asp?bandName=<% objRS(&quot;bandName&quot;) %>&quot;></a>
When a person clicks on the link, the name of the band referenced by objRS(&quot;bandName&quot;) will be returned and can be accessed using the request.querystring method:
Code:
'This code is on showBandDetail.asp page

strBandName = request.querystring(&quot;bandName&quot;)

strSQL = &quot;SELECT * FROM myTable where bandName = &quot; & &quot;'&quot; & bandName & &quot;'&quot;

'Open up database connection as normal ...
HTH,

Kevin
[sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top