macdaddy
06-12-2003, 07:07 PM
Hello, I have a tricky problem, but i think it is almost good. I have a page which will display all the offices in a certain area of ontario, depending on what variable is sent from the previous page, all the offices come from a table called t_web_pratice. this is working fine. Now in every office it has people working in the office, so another table t_web_profile has all the people in it, they all have a practiceID fields which is also the primary key for t_web_practice offices. So in my display page, i want each office to be displayed, as well as all the people that work in that specific office. My code is almost done, the problem that i am having, is that the very first office to be listed, has every single person listed as working in it, and the other offices have none. So I am having problems setting the ID number to be specific for whatever loop it is in. I hope i explained this well. this is my code, and i think this should be an easy one for some of u
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.QueryString("id") <> "") Then
Recordset1__MMColParam = Request.QueryString("id")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_mine_STRING
'Recordset1.Source = "SELECT * FROM t_web_practices WHERE region = '" + Replace(Recordset1__MMColParam, "'", "''") + "' ORDER BY PracticeName ASC"
Recordset1.Source = "SELECT * FROM t_web_practices INNER JOIN t_web_profile ON t_web_profile.PracticeID = t_web_practices.[PracticeId] WHERE region = '" + Replace(Recordset1__MMColParam, "'", "''") + "' ORDER BY PracticeName ASC"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<!--#Include File = "findingImages/findingHead.asp"-->
<!--#Include File = "banner.htm"-->
<table width="751" height="265" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="151" align="left" valign="top"><!--#Include File = "findingImages/aboutDown.asp"-->
</td>
<td width="600" align="center" valign="top"><table width="574" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="73">
<div align="left"><img src="findingImages/finding.gif" width="400" height="73"></div></td>
</tr>
<tr>
<td height="55" valign="top"><img src="findingImages/findingRegion.gif" width="550" height="55"></td>
</tr>
<tr>
<td height="239" valign="top"> <%
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
%>
<table width="600" height="161" border="0" cellpadding="0" cellspacing="0">
<tr bgcolor="#CCCC99">
<td height="35" colspan="2"><font size="3" face="Arial, Helvetica, sans-serif"><strong>
<%=(Recordset1.Fields.Item("PracticeName").Value)%></strong></font></td>
</tr>
<tr>
<td width="333" valign="top"><font size="3" face="Arial, Helvetica, sans-serif"><strong>Address:</strong><br>
<%=(Recordset1.Fields.Item("Address1").Value)%>, <%=(Recordset1.Fields.Item("Address2").Value)%><br>
<%=(Recordset1.Fields.Item("City").Value)%>, <%=(Recordset1.Fields.Item("Province").Value)%>
<br>
<%=(Recordset1.Fields.Item("PC").Value)%></font></td>
<td width="267" valign="top"><font size="3" face="Arial, Helvetica, sans-serif">
<% if ((Recordset1.Fields.Item("Internet").Value) <> "" ) THEN Response.write "<strong>Email:</strong> <a href='mailto:'" & (Recordset1.Fields.Item("Internet").Value) & "' class='in'>" & (Recordset1.Fields.Item("Internet").Value) & "</a><br>"
%>
<strong>Phone:</strong> <%=(Recordset1.Fields.Item("Telephone").Value)%><br>
<strong>Fax:</strong> <%=(Recordset1.Fields.Item("Fax").Value)%><br>
<% if ((Recordset1.Fields.Item("TTY").Value) <> "" ) THEN Response.write "<strong>Phone 2:</strong>" & (Recordset1.Fields.Item("TTY").Value) & "<br>"
%>
</td>
</tr>
<tr>
<td colspan="2"><font size="3" face="Arial, Helvetica, sans-serif"><strong> <br>
Midwives praticing at this location</strong></font><br>
<br>
<%
Dim Repeat2__numRows
Dim Repeat2__index
Repeat2__numRows = -1
Repeat2__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat2__numRows
%>
<table width="600" height="58" border="0" cellpadding="0" cellspacing="0">
<%
While ((Repeat2__numRows <> 0) AND (NOT Recordset1.EOF))
%>
<tr>
<td width="280"><%=(Recordset1.Fields.Item("CertificateName").Value)%></td>
<td width="320">more details </td>
</tr>
<%
Repeat2__index=Repeat2__index+1
Repeat2__numRows=Repeat2__numRows-1
Recordset1.MoveNext()
Wend
%>
</table>
</td>
</tr>
</table>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset1.MoveNext()
Wend
%>
<p> </p>
</td>
</tr>
</table></td>
</tr>
</table>
<!--#Include File = "footer.asp"-->
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.QueryString("id") <> "") Then
Recordset1__MMColParam = Request.QueryString("id")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_mine_STRING
'Recordset1.Source = "SELECT * FROM t_web_practices WHERE region = '" + Replace(Recordset1__MMColParam, "'", "''") + "' ORDER BY PracticeName ASC"
Recordset1.Source = "SELECT * FROM t_web_practices INNER JOIN t_web_profile ON t_web_profile.PracticeID = t_web_practices.[PracticeId] WHERE region = '" + Replace(Recordset1__MMColParam, "'", "''") + "' ORDER BY PracticeName ASC"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<!--#Include File = "findingImages/findingHead.asp"-->
<!--#Include File = "banner.htm"-->
<table width="751" height="265" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="151" align="left" valign="top"><!--#Include File = "findingImages/aboutDown.asp"-->
</td>
<td width="600" align="center" valign="top"><table width="574" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="73">
<div align="left"><img src="findingImages/finding.gif" width="400" height="73"></div></td>
</tr>
<tr>
<td height="55" valign="top"><img src="findingImages/findingRegion.gif" width="550" height="55"></td>
</tr>
<tr>
<td height="239" valign="top"> <%
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
%>
<table width="600" height="161" border="0" cellpadding="0" cellspacing="0">
<tr bgcolor="#CCCC99">
<td height="35" colspan="2"><font size="3" face="Arial, Helvetica, sans-serif"><strong>
<%=(Recordset1.Fields.Item("PracticeName").Value)%></strong></font></td>
</tr>
<tr>
<td width="333" valign="top"><font size="3" face="Arial, Helvetica, sans-serif"><strong>Address:</strong><br>
<%=(Recordset1.Fields.Item("Address1").Value)%>, <%=(Recordset1.Fields.Item("Address2").Value)%><br>
<%=(Recordset1.Fields.Item("City").Value)%>, <%=(Recordset1.Fields.Item("Province").Value)%>
<br>
<%=(Recordset1.Fields.Item("PC").Value)%></font></td>
<td width="267" valign="top"><font size="3" face="Arial, Helvetica, sans-serif">
<% if ((Recordset1.Fields.Item("Internet").Value) <> "" ) THEN Response.write "<strong>Email:</strong> <a href='mailto:'" & (Recordset1.Fields.Item("Internet").Value) & "' class='in'>" & (Recordset1.Fields.Item("Internet").Value) & "</a><br>"
%>
<strong>Phone:</strong> <%=(Recordset1.Fields.Item("Telephone").Value)%><br>
<strong>Fax:</strong> <%=(Recordset1.Fields.Item("Fax").Value)%><br>
<% if ((Recordset1.Fields.Item("TTY").Value) <> "" ) THEN Response.write "<strong>Phone 2:</strong>" & (Recordset1.Fields.Item("TTY").Value) & "<br>"
%>
</td>
</tr>
<tr>
<td colspan="2"><font size="3" face="Arial, Helvetica, sans-serif"><strong> <br>
Midwives praticing at this location</strong></font><br>
<br>
<%
Dim Repeat2__numRows
Dim Repeat2__index
Repeat2__numRows = -1
Repeat2__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat2__numRows
%>
<table width="600" height="58" border="0" cellpadding="0" cellspacing="0">
<%
While ((Repeat2__numRows <> 0) AND (NOT Recordset1.EOF))
%>
<tr>
<td width="280"><%=(Recordset1.Fields.Item("CertificateName").Value)%></td>
<td width="320">more details </td>
</tr>
<%
Repeat2__index=Repeat2__index+1
Repeat2__numRows=Repeat2__numRows-1
Recordset1.MoveNext()
Wend
%>
</table>
</td>
</tr>
</table>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset1.MoveNext()
Wend
%>
<p> </p>
</td>
</tr>
</table></td>
</tr>
</table>
<!--#Include File = "footer.asp"-->
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>