ahill 0 Posted June 9, 2015 Report Share Posted June 9, 2015 (edited) 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. Edited June 9, 2015 by ahill Quote Link to post Share on other sites
ahill 0 Posted June 9, 2015 Author Report Share Posted June 9, 2015 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 %> Quote Link to post Share on other sites
ahill 0 Posted June 9, 2015 Author Report Share Posted June 9, 2015 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 %> Quote Link to post Share on other sites
justsomeguy 1,135 Posted June 9, 2015 Report Share Posted June 9, 2015 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. Quote Link to post Share on other sites
justsomeguy 1,135 Posted June 9, 2015 Report Share Posted June 9, 2015 I've merged the topics, please don't make duplicate topics. Quote Link to post Share on other sites
ahill 0 Posted June 9, 2015 Author Report Share Posted June 9, 2015 (edited) i am using vbscript for coding Edited June 9, 2015 by ahill Quote Link to post Share on other sites
justsomeguy 1,135 Posted June 9, 2015 Report Share Posted June 9, 2015 I understand that, but this is an ASP question. URLs don't apply to VB scripts outside of ASP. If your topic can go in multiple forums then pick the one that best fits. Quote Link to post Share on other sites
ahill 0 Posted June 9, 2015 Author Report Share Posted June 9, 2015 ok so vb does not matter on the code end of the page? I was told by someone else that I had to use If Else Statements Quote Link to post Share on other sites
justsomeguy 1,135 Posted June 9, 2015 Report Share Posted June 9, 2015 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 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.