Jump to content

How do I write a page so it reloads with new data


Recommended Posts

Hey guys new to ASP so my terminology may not be quite right. Looking to build a page that has a table that it pulls from SQL database. Every time you click on an image on the table i want the page to pull the variable and reload in the same page to a new variable. So it sort of drills down variables.

 

Currently my page pulls from my database and displays images the way it needs to. Now i need to be able to click on the image and have the page reload into the same page with the variable selected. My database is set up already.

post-185325-0-83582500-1433859109_thumb.png

Edited by ahill
Link to post
Share on other sites
This is currently the code I have to display the table with images
SQL = "select type from resources group by type order by type"
RSb.Open SQL,Conn
Dim mytype,mr,mpic
mr = 1
If rsb.eof then
'response.write "NOT FOUND"
else
do until rsb.eof
mytype = trim(rsb("type"))
mpic = mytype & ".JPG"
If mr = 1 then
response.write "<tr>"
end if
Response.write "<td><img src=""images/"& mpic &""" />"
Response.write mpic & "</td>"
If mr = 3 then
mr = 0
response.write "</tr>"
end if
mr = mr + 1
rsb.movenext
loop
response.write "</table>"
end if
%>
Link to post
Share on other sites

Hey guys new to ASP so my terminology may not be quite right. Looking to build a page that has a table that it pulls from SQL database. Every time you click on an image on the table i want the page to pull the variable and reload in the same page to a new variable. So it sort of drills down variables.

Currently my page pulls from my database and displays images the way it needs to. Now i need to be able to click on the image and have the page reload into the same page with the variable selected. My database is set up already.

this is currently the code I have to display the table with images
SQL = "select type from resources group by type order by type"
RSb.Open SQL,Conn
Dim mytype,mr,mpic
mr = 1
If rsb.eof then
'response.write "NOT FOUND"
else
do until rsb.eof
mytype = trim(rsb("type"))
mpic = mytype & ".JPG"
If mr = 1 then
response.write "<tr>"
end if
Response.write "<td><img src=""images/"& mpic &""" />"
Response.write mpic & "</td>"
If mr = 3 then
mr = 0
response.write "</tr>"
end if
mr = mr + 1
rsb.movenext
loop
response.write "</table>"
end if
%>

post-185325-0-98923200-1433862753_thumb.png

Link to post
Share on other sites

Write out links with the values in the link, e.g.:page.asp?type=waterYou can use Request.QueryString to get variables in the URL to see what was passed, and query the database appropriately.

Link to post
Share on other sites

You'll need to write your code in VBScript if that's what you're using with ASP, yes. Correct, you'll use if statements to check if the name is in the list of things you want to skip. There's a brief description here:http://www.w3schools.com/vbscript/vbscript_conditionals.aspIt looks like they only use the = operator in those examples, the other operators you can use are listed here:https://msdn.microsoft.com/en-us/library/9hck4s70(v=vs.84).aspx

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...