Please help with url string

Results 1 to 2 of 2

Thread: Please help with url string

  1. #1
    Join Date
    Dec 1969

    Default Please help with url string

    Hope someone can help me with some coding that i don&#039t understand.<BR>I have quite a few queries on a page that has a numbered criteria such as 1<BR>The next week this criteria will change to 2 and 3 for 3rd week, so on and so on.... but i want to keep all the queries on a page for back referencing...<BR>I have made an include file that makes my db conn and dims this criteria so i only have to change it in one place...<BR>Is it possible for me on my query page to name that page i.e<BR>week1.asp or week2.asp and when that page is loded and calls my include file for the connection and criteria, is it possible for the include file to pull the number from the url and set it for the criteria?<BR>This is how it works now.<BR><BR>data_con.asp<BR>&#060;%<BR>dim Conn<BR>Set Conn = Server.CreateObject("ADODB.CONNECTION")<BR>Conn.Op en "juice","",""<BR><BR>Dim WeekNumber <BR>WeekNumber = 1 &#039This is the criteria passed to next page <BR>Function CloseConn()<BR>set Conn = Nothing<BR>End Function<BR>%&#062;<BR><BR>week1.asp<BR><BR>&#060; !--#INCLUDE FILE=data_conn.asp--&#062;<BR>&#039not posting all code here this is just an example<BR>MySQL = "SELECT Member, Score, FROM ogt WHERE (week) = " & WeekNumber &#039This represents the criteria set on include file<BR>Set RS = Conn.Execute(MySQL)<BR><BR>So to recap, is it possible to have the include file set the criteria using the page that being loaded (week1.asp)<BR>how would that page be named and how & where would the coding go?<BR><BR>Doing this will save me from making a separate &#060;include file&#062; for every page to change criteria.<BR><BR>I hope this can be done and any help will be greatly appreciated.<BR>Thanks in advance<BR>Russell<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Please help with url string

    I don&#039t really understand what you are trying to achieve but here is an attempted answer...<BR><BR>Why not store the week numbers in your database (or maybe just determine them from the current date using DatePart() function)? <BR><BR>Your include file could then test if it knows the value of "WeekNumber". If not, then it could set it to the value required (perhaps "SELECT max(WeekNbr) FROM WeekNbrs" or similar). Then all the subsequent SELECT statements in the include file use this variable in the WHERE clause. <BR><BR>If you then want to get &#039scores&#039 (or whatever data) for a different week, just set the variable and your include file&#039s queries should work jsut the same. Perhaps user could select the week they want from a list, populated from your table of weeknbrs?<BR><BR>hope that gives you a lead.<BR>Tim.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts