Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

populate menu

Status
Not open for further replies.
Aug 1, 2003
85
US
I started this in another section but was told it was in the wrong place so here goes. =)
The code was done in dreamweaver and I just played around with it.

Anywho, I've built a detail page that gets the userid from a querystring. That string populates a text field (username) and list menu (pagelinks) by referencing the recordset.

Recordset =
SELECT useraccess.UserID, useraccess.Username, linkdetail.pagelinkIDdetail, pagelinks.pagelinks
FROM useraccess INNER JOIN (pagelinks INNER JOIN linkdetail ON pagelinks.pagelinkID = linkdetail.pagelinkIDdetail) ON useraccess.UserID = linkdetail.userID
WHERE useraccess.UserID<>MMColParam

I have three tables USERACCESS (userid, username, userpassword, userlevel) , LINKDETAIL (id, userid, pagelinkdetail) , and PAGELINKS (pagelinkid, pagelinks).

USERACCESS userid(1) inner join LINKDETAIL userid(many)
PAGELINK pagelinkid(1) inner join LINKDETAIL pagelinkiddetail(many)

There will be several different userid's, with access to many pagelinks.

What I'm trying do is populate the drop down list with pagelinks that aren't already assigned to that user. Then use an insert behavior to add userid and pagelinkiddetail to the linkdetail table. Which will in turn remove that pagelink from the menu.

here's the code:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/conntesttsrserv.asp" -->
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.QueryString("UserID") <> "") Then
Recordset1__MMColParam = Request.QueryString("UserID")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_conntesttsrserv_STRING
Recordset1.Source = "SELECT useraccess.UserID, useraccess.Username, linkdetail.pagelinkIDdetail, pagelinks.pagelinks FROM useraccess INNER JOIN (pagelinks INNER JOIN linkdetail ON pagelinks.pagelinkID = linkdetail.pagelinkIDdetail) ON useraccess.UserID = linkdetail.userID WHERE useraccess.UserID<>" + Replace(Recordset1__MMColParam, "'", "''") + ""
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>

<body>
<table width="100%" height="82" border="0">
<tr>
<td><form name="form1" method="post" action="">
<p>
Username
<%=(Recordset1.Fields.Item("Username").Value)%>
</p>
<p> pagelinks
<select name="pagelinkid" id="pagelinkid">
<%
While (NOT Recordset1.EOF)
%>
<option value="<%=(Recordset1.Fields.Item("pagelinkIDdetail").Value)%>"><%=(Recordset1.Fields.Item("pagelinks").Value)%></option>
<%
Recordset1.MoveNext()
Wend
If (Recordset1.CursorType > 0) Then
Recordset1.MoveFirst
Else
Recordset1.Requery
End If
%>
</select>
</p>
<p>
<input type="submit" name="Submit" value="Add pagelink">
</p>
</form></td>
</tr>
</table>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>

Any help greatly appreciated.
Thanks,
Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top