I'm new to this old scripting language but it's all we have right now. I'm trying to get this code work.
I would like to compare USERID servervariable with the same USERID from a recordset, then if true it will redirect the name of that USERID.
<%
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=I:\storyData.mdb"
set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "SELECT USERIDFROM preprod", conn
strName = "John"
strNo = "This is not you"
If Request.ServerVariables("HTTP_USERID") = (rs.Fields.Item("USERID").Value) Then
Response.Redirect("story.html?" & "name=" & strName)
Else
Response.Redirect("story.html?" & "name=" & strNo)
End If
%>
I hope this makes any sense. It seems simple but can't get it to work.
thanks
what "doesn't" work?
looking at your code, it seems you're only checking the the first record of your query. I think you want to do something like this:
this code does a count of userIDs in your table and if there are more than 1, it'll do the redirect properly. A lot more efficient this way.