codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Pulling Data from 2 tables with variables from a 3rd table!!!  iiswansongii at 00:15 on Thursday, December 11, 2008
 

I've been coming to this site for a while and love it! But I hope that someone can help me.

I'm in a pickle with this one.

I have 3 tables.

t_camp_locations
this holds information about each camp.


t_staff
this holds information about each staff member.


t_camp_staff
this holds id's that define what camps the staff that are entered coach at.
for example:
coach 1 is id #12 and he trains at camp id# 1,2,3,4,5,6,7,8


The admin tools for these pages are fine.
My trouble is I'm trying to create the front end that the public will see.

I can't figure out how to 'display' on the staff page a list of all the staff that trains in camp #1.

How do I pull from 2 content tables, based on what is defined in a third table?


Here is the start of what i have:


<%

Session("displayID") = request("camp_id")

'query to pull in the selected Camp Location for each staff member details
'sql = "SELECT * FROM t_camp_staff WHERE camp_id = " & request.querystring("id") & ""
sql = "SELECT * FROM t_camp_staff WHERE camp_id = '1'"


Session("staffID") = request("id")

'query to pull in the selected Camp Location for each staff member details
sql = "SELECT id FROM t_staff"
set rs = server.createobject("adodb.recordset")
rs.Open sql, conn, 3, 3

%>



<table cellpadding="4" border="0">



<%

'GET PAGE CONTENT

Set rs = server.CreateObject("ADODB.RecordSet")

rs.Open "SELECT * FROM t_staff WHERE id = " & Session("staffID") & ""

%>


<%
Do While NOT rs.EOF
Response.Write "<tr><td valign='top'>"

If rs("img") > "" Then
Response.Write "<table cellpadding='1' bgcolor='#000000'><tr><td><img src='images/staff/" & rs("img") & "'></td></tr></table>" & vbCrLf
Else
Response.Write "</td>"
End If

Response.Write "<td>"

If rs("f_name") > "" Then
Response.Write "<b>" & rs("f_name") & " " & rs("l_name") & "</b><br>" & vbCrLf
Else
Response.Write ""
End If

If rs("paragraph") > "" Then
Response.Write "" & rs("paragraph") & "<br><br>" & vbCrLf
Else
Response.Write ""
End If



Response.Write "</td></tr>"
Response.Write "<tr><td height='1'></td></tr>"

rs.MoveNext
Loop

%>


</table>


Thank you in advance for ANY help you can give me! I'm stressin'!










CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  OPENING FOR: PERL (Developer/ Senior/ Team Lead)
•  Re: Help with code
•  remove character on a line of a file with check box
•  Pulling Data from 2 tables with variables from a 3rd table!!!
•  Dynamic Usemap Problem
•  How to highlight text WITHIN a JTable cell?
•  How to highlight text WITHIN a JTable cell?
•  c++ project
•  Re: submit button


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2008