|
| |
|
|
Twopigs
Posts: 147 Joined: 8/22/2002 Status: offline
|
2 loops in results? - 10/6/2005 11:34:30
I am trying to get a yes or no to come up if the results of 2 loops match. Here is the code on my page: <!--#include file="connection06.asp"-->
<%sql = "select *from CustList2 where ATTID ="&cint(session("attendeeid"))
'response.write sql
Set ATTrs = conn.Execute(sql)%>
<!--#include file="vendor-connection.asp"-->
<table cellspacing="1" cellpadding="2" border="0">
<tr>
<td colspan="2"><font size="+2"><strong>Current Exhibitor List</strong></font></td><td><a href="Exhibitor_List_06_CustList_booth.asp"><font size="-1"><strong>order by booth #</strong></font></a></td>
</tr>
<tr>
<td> </td>
<td><font size="+1"><strong><em>Company</em></strong></font></td>
<td><font size="+1"><strong><em>Booth #</em></strong></font></td>
</tr>
<tr><% sql ="SELECT * FROM 06Vendors WHERE instr(INSHOW,'Y') ORDER BY Company"
set rs = conn.execute(sql)%>
<% Do until rs.EOf %>
<td> </td>
<td><% If ((session("attendeeid") <> "") or (session("vendorid") <> "")) then%><a href="Company_details06BG.asp?vendorid=<%=rs("id")%>"><%=rs("Company")%></a><% Else %><a href="Company_details06.asp?vendorid=<%=rs("id")%>"><%=rs("Company")%></a><% End If %></td>
<td><%= rs("Chicago06")%></td>
<td><input type="checkbox" name="Mailfrom" value="ML_<%=rs("id")%>"<%If instr((trim(ATTrs("mailfrom"))&","),((rs("id"))&","))>=1 then %>Checked<% End If %>></td>
<td><%= ATTrs("Mailfrom")%></td>
</tr>
<% rs.movenext
Loop %> I need to loop the Custlist2 for all records that contain the ATTID right now I have 2 test records in the Custlist2 database with the same value "11" in the ATTID field and 2 different #'s in the Mailfrom field. I wanted the check box to show checked when Mailfrom # coming from Custlist2 matches the ID from the vendors database. The code above was written when I was trying to put all the values in one field (mailfrom) in one record, I am now having it insert a new record everytime they pick a vendor. Thanks for any help in advance Scott
_____________________________
|
|
|
|
Twopigs
Posts: 147 Joined: 8/22/2002 Status: offline
|
RE: 2 loops in results? - 10/6/2005 16:00:53
LOL, your never wacked! i'm the one who sends the "wacked" questions. The way it is set up now, I won't have to have the ML_ I just tried that code, and it doesn't seem to work. Take a look at the results that come up. Here is the login page: http://logistar.com/newsite/attendee_login.asp Username: binky password: girl when logged in click on "Custom Email List" on the left. I see it's only calling one record from the database the (1566) I have 2 records in there with different values, but the ATTID is the same # I'm thinking it has to loop (1st loop) the Custlist2 and pull out all records with the ATTID that is = to 11 (which is the session id #) then it has to check to see if Mailfrom in Custlist2 Matches the rs(ID) from the vendor database. and if it does, put a YES next to their name in the 2nd loop. Does that make any sense... What always bugs me is knowing there is probably a more straight forward way to do this...i'm just don't know enough about it. Thanks for putting up with me....I'll get this stuff....someday! Here's what that whole page looks like (Exhibitor_List_06_Custlist.asp) <% Select Case request("stat") %>
<% Case "updated" %>
<%Response.write("You have Successfully updated your custom mail list")%>
<% Case Else%>
<% End Select %>
<form action="Mailfrom-Custlist-insert.asp" method="post">
<!--#include file="connection06.asp"-->
<%sql = "select *from CustList2 where ATTID ="&cint(session("attendeeid"))
'response.write sql
Set ATTrs = conn.Execute(sql)%>
<!--#include file="vendor-connection.asp"-->
<table cellspacing="1" cellpadding="2" border="0">
<tr>
<td colspan="2"><font size="+2"><strong>Current Exhibitor List</strong></font></td><td><a href="Exhibitor_List_06_CustList_booth.asp"><font size="-1"><strong>order by booth #</strong></font></a></td>
</tr>
<tr>
<td> </td>
<td><font size="+1"><strong><em>Company</em></strong></font></td>
<td><font size="+1"><strong><em>Booth #</em></strong></font></td>
</tr>
<tr><% sql ="SELECT * FROM 06Vendors WHERE instr(INSHOW,'Y') ORDER BY Company"
set rs = conn.execute(sql)%>
<% Do until rs.EOf %>
<td> </td>
<td><% If ((session("attendeeid") <> "") or (session("vendorid") <> "")) then%><a href="Company_details06BG.asp?vendorid=<%=rs("id")%>"><%=rs("Company")%></a><% Else %><a href="Company_details06.asp?vendorid=<%=rs("id")%>"><%=rs("Company")%></a><% End If %></td>
<td><%= rs("Chicago06")%></td>
<%If trim(ATTrs("mailfrom")&"" = rs("id")) then%>
<td>YES</td>
<%else%>
<td>NO</td>
<td><%= ATTrs("Mailfrom")%></td>
<% End If %>
</tr>
<% rs.movenext
Loop %>
<tr>
_____________________________
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|