a webmaster learning community
     Home    Register     Search      Help      Login    
FrontPage Alternative
Sponsors

Hosting from $3.99 per month!

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions. dd

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

2 loops in results?

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> 2 loops in results?
Page: [1]
 
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

_____________________________

rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: 2 loops in results? - 10/6/2005 13:04:24   
Is it working now? (Dumb Q I know but I have to ask. :))

What is the problem with it? What error codes if any?

What happens if you response.write all your variables along the way? Do they really match or does the data look different than what it should be?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to Twopigs)
Twopigs

 

Posts: 147
Joined: 8/22/2002
Status: offline

 
RE: 2 loops in results? - 10/6/2005 13:19:50   
Sorry Rdouglass....i'm stupid.. :)

Your code that you gave me for searching through one field worked perfect, but I ran into another problem and "thought" I could set it up in another way. Instead of having everything go into one field in each record, I am going to have it put multiple records in with the same attendee id #

Example: I am an attendee, I pick 3 exhibitors I would like to get email from, it will put 3 records in the table "custlist"

ATTID Fname Lname email mailfrom created

11 scott phillips sp@mail.com 1656 10/6/2005
11 scott phillips sp@mail.com 1457 10/7/2005
11 scott phillips sp@mail.com 2245 10/8/2005

That way when Attendees open their page "Custom e mail list"
it will pull from CustList where ATTID = their session id

And when exhibitors are in their page, it will call from Custlist where Mailfrom = their session ID

I wanted to have it put a Yes or No next to the exhibitor name, so it would have to check If Mailfrom is equal to rs(id) then put YES else no.
but I have to pull all the records from custlist and I don't know how to have a "do until eof" for that, and mesh it with the Loop I have running for the exhibitor list itself.

Thanks for bearing with me....you've been so much help! I know this is an easy one....but I am brain dead...I just can't seem to get my idea working...



_____________________________


(in reply to rdouglass)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: 2 loops in results? - 10/6/2005 15:26:25   
quote:

<%If instr((trim(ATTrs("mailfrom"))&","),((rs("id"))&","))>=1 then %>Checked<% End If %>


Maybe I'm not seeing something right but wouldn't a 'simple' check work?

<%If trim(ATTrs("mailfrom"))&"") = rs("id")) then %>Checked<% End If %>

Or are you dealing with the "ML_" issue here as well? Or is "mailfrom" a list? Or am I totally whacked? (I seem that way today.) :)

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to Twopigs)
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>



_____________________________


(in reply to rdouglass)
Page:   [1]
OutFront Discoveries

All Forums >> Web Development >> ASP and Database >> 2 loops in results?
Page: [1]
Jump to: 1





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