PDA

Click to See Complete Forum and Search --> : Please Help with QueryString


HakanAzaklioglu
Jul 27th, 2000, 08:50 AM
I have posted multiple times and find my self in the same spot I would like to basically start over.

If any could give me an example on how i can retrieve variables from a url the I populated from a previous page and use them to call data from a database that would be so great...

To better explain my self I would like to have a piece of code that would work in the following manner...

Code:
===========================================================

<%@ LANGUAGE=VBSCRIPT %>

<%
SET CONN = SERVER.CREATEOBJECT ("ADODB.CONNECTION")
CONN.OPEN "MYDSN"
%>

<%
DIM STORE
DIM MTYPE
DIM rsSUBJ

SET STORE = REQUEST.QUERYSTRING("STOREID")
SET MTYPE = REQUEST.QUERYSTRING("TYPE")

SET rsLOCATION = CONN.EXECUTE("SELECT ID, LOCATION FROM CIEMPDIR WHERE ID = " _
& STORE )

SET rsSUBJ = CONN.EXECUTE("SELECT emaillist.Id, emaillist.sub, emaillist.type FROM emaillist WHERE (((emaillist.Id)=" & STORE) AND ((emaillist.type)=" & MTYPE)) ")

SET rsBODY = CONN.EXECUTE("SELECT emaillist.Id, emaillist.body, emaillist.type FROM emaillist WHERE (((emaillist.Id)=11) AND ((emaillist.type)='week')) ")

%>

===========================================================

rsLOCATION works fine... but there again my problem lies only when i try to write code that allows a variable like rsSUBJ and rsBODY...

On rsBODY I manually entered one set of the values manually to see if I was atleast remotley close and it worked but when I try to automate the process by having it retrieve the variables from the url using the request.querystring I always error out with some kind of sytax thing.

Please adivse... Help would be greatly apreciated...

Kind Regards,
Hakan

lambela8
Jul 27th, 2000, 02:27 PM
Does SET myvar = request.querysting("id") work?

I always use it without the SET. Maybe the SET is your problem?