Skal kun skrive ud hvis 2 felter i hver sin tabel er ens
Hej !Prøver at lave noget der kun skrive nogle billeder ud hvis 2 felter fra hver sin tabel er ens. Tabellerne er testtabel og billeder. Felterne er rsguestbook("id_no") og rsguestbook("id")
Søg efter dette i koden for at finde der hvor jeg tror det skal ind. Felterne i de 2 databaser skal være ens og der kan kun være 1 rsguestbook("id_no") men der kan godt være flere rsguestbook("id")
****************Det er her det skal sættes ind : ****************
Koden :
<% Session.LCID=1030 %>
<%
'if isEmpty(session("UserID")) then
' Response.Redirect "../../bruger/asp/logadmin.asp?msg=" & Server.URLEncode ("Du skal være logget ind for at se fangstrapporter.")
'end if
%>
<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsGuestbook 'Holds the recordset for the record to be updated
Dim strSQL 'Holds the SQL query for the database
Dim strsql2
Dim lngRecordNo 'Holds the record number to be updated
'Read in the record number to be updated
lngRecordNo = CLng(Request.QueryString("ID"))
'Create an ADO connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("../db/test.mdb")
'Set an active connection to the Connection object using DSN connection
'adoCon.Open "DSN=guestbook"
'Create an ADO recordset object
Set rsGuestbook = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to query the database
'strSQL = "SELECT testtabel.* FROM testtabel WHERE ID_no=" & lngRecordNo
strSQL = "SELECT * FROM testtabel,billeder WHERE ID_no=" & lngRecordNo & "" & " order by id_nr"
'Open the recordset with the SQL query
rsGuestbook.Open strSQL, adoCon
%>
<html>
<head>
<title>View_selected</title>
<link rel="stylesheet" type="text/css" href="../../style.css">
<meta http-equiv="Cache-Control" content="no-store">
<meta http-equiv="Pragma" content="no-cache">
</head>
<body bgcolor="#232323" text="black">
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="530" id="AutoNumber2">
<tr>
<td width="100%" class=head align=center>
<% = rsGuestbook("forfatter") %>'s fangstrapport
</td>
</tr>
<tr>
<td width="100%">
</td>
</tr>
</table>
</center>
</div>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="530" id="AutoNumber2">
<tr>
<td width="100%" align=left class=text1>
<a href="view_select_bg.asp">
Tilbage
</a>
</td>
</tr>
</table>
</center>
</div>
<br>
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" style="border-width:0px; border-collapse: collapse" width="530" id="table2" bordercolor="#000000">
<tr>
<td colspan="4" align=center class="head" ><b><% = rsGuestbook("overskrift") %></b></td>
</tr>
<tr>
<td colspan="4" align=center class="head"> </td>
</tr>
<tr>
<td class="text1" rowspan="9" width="20%" style="border-left: medium none #000000; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom: medium none #000000">
<%if len(rsGuestbook("url"))>0 then
maksbredde = 150
makshojde = 180
'
'
'Du mangler at ha' komponenten (ImgSize.Check) installeret på serveren Kristian!
'Den bruges til at finde ud af, hvor stort billedet er!
'Måske hedder den noget andet hos din udbyder!?
'
Set objImg = Server.CreateObject("ImgSize.Check")
objImg.FileName = server.mappath(rsGuestbook("url"))
if objImg.Height > makshojde then
ratio = objImg.Height / makshojde
newheight = objImg.Height /ratio
newwidth = objImg.Width /ratio
if newwidth > maksbredde then
ratio = newwidth / maksbredde
newheight = newheight /ratio
newwidth = newwidth /ratio
end if
elseif objImg.Width > maksbredde then
ratio = objImg.Width / maksbredde
newheight = objImg.Height /ratio
newwidth = objImg.Width /ratio
if newheight > makshojde then
ratio = newheight / makshojde
newheight = newheight /ratio
newwidth = newwidth /ratio
end if
else
newheight = objImg.Height
newwidth = objImg.Width
end if
%>
<a href="<%= rsguestbook("url")%>" target=_blank>
<img src="<%= rsguestbook("url")%>" border="0" height="<%= newheight %>" width="<%= newwidth %>" align="top"></a>
<% else %>
<img src="../images/nopix.gif" border="0" align="top">
<%end if%>
</td>
<td class="text1" width="4%" style="border-style: none; border-width: medium">
</td>
<td class="text1" width="30%" style="border-style: none; border-width: medium">
Indsendt af</td>
<td class="text1" style="border-style: none; border-width: medium" >
:<% = rsGuestbook("forfatter") %></td>
</tr>
<tr>
<td class="text1" width="4%" style="border-style: none; border-width: medium"> </td>
<td class="text1" width="30%" style="border-style: none; border-width: medium">Dato for fangst</td>
<td class="text1" style="border-style: none; border-width: medium" >
:<% = rsGuestbook("fangstmnd") %></td>
</tr>
<tr>
<td class="text1" width="4%" style="border-style: none; border-width: medium"> </td>
<td class="text1" width="30%" style="border-style: none; border-width: medium">Fangst</td>
<td class="text1" style="border-style: none; border-width: medium" >
:<% = rsGuestbook("fangst") %></td>
</tr>
<tr>
<td class="text1" width="4%" style="border-style: none; border-width: medium"> </td>
<td class="text1" width="30%" style="border-style: none; border-width: medium">Agn</td>
<td class="text1" style="border-style: none; border-width: medium" >
:<% = rsGuestbook("agn") %></td>
</tr>
<tr>
<td class="text1" width="4%" style="border-style: none; border-width: medium">
</td>
<td class="text1" width="30%" style="border-style: none; border-width: medium">
Vægt i kg</td>
<td class="text1" style="border-style: none; border-width: medium" >
: <% = rsGuestbook("vaegt") %></td>
</tr>
<tr>
<td class="text1" width="4%" style="border-style: none; border-width: medium">
</td>
<td class="text1" width="30%" style="border-style: none; border-width: medium">
Kategori</td>
<td class="text1" style="border-style: none; border-width: medium" >
: <% = rsGuestbook("metode") %></td>
</tr>
<tr>
<td class="text1" width="4%" style="border-style: none; border-width: medium">
</td>
<td class="text1" width="30%" style="border-style: none; border-width: medium">
Sted</td>
<td class="text1" style="border-style: none; border-width: medium" >
: <% = rsGuestbook("sted") %></td>
</tr>
<tr>
<td class="text1" width="4%" style="border-style: none; border-width: medium">
</td>
<td class="text1" width="30%" style="border-style: none; border-width: medium">
Oprettet d.</td>
<td class="text1" style="border-style: none; border-width: medium" >
: <% = rsGuestbook("dato") %></td>
</tr>
<tr>
<td class="text1" width="4%" style="border-style: none; border-width: medium">
</td>
<td class="text1" width="30%" style="border-style: none; border-width: medium">
Klokken</td>
<td class="text1" style="border-style: none; border-width: medium" >
: <% = rsGuestbook("tid") %></td>
</tr>
</table>
</div>
<br>
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-bottom-width:0px" width="530" id="table2" bordercolor="#000000">
<tr>
</tr>
<tr>
<%
' str = rsguestbook("beretning")
' str = replace(str, "f1", "<img src='../html-images/bid.jpg' width='45' height='62'>")
' str = replace(str, "F1", "<img src='../html-images/bid.jpg' width='45' height='62'>")
' str = replace(str, "f2", "<img src='../html-images/fisk.jpg' width='68' height='65'>")
' str = replace(str, "F2", "<img src='../html-images/fisk.jpg' width='68' height='65'>")
' str = replace(str, "so1", "<img src='../html-images/lake.jpg' width='81' height='47'>")
' str = replace(str, "SO1", "<img src='../html-images/lake.jpg' width='81' height='47'>")
' str = replace(str, "linux", "<img src='../html-images/linux.jpg' width='68' height='69'>")
' str = replace(str, "LINUX", "<img src='../html-images/linux.jpg' width='68' height='69'>")
' str = replace(str, "stang1", "<img src='../html-images/rod.jpg' width='53' height='78'>")
' str = replace(str, "STANG1", "<img src='../html-images/rod.jpg' width='53' height='78'>")
' str = replace(str, ";)", "<img src='../html-images/yellowsmile.gif'>")
' str = replace(str, ":o", "<img src='../html-images/1.gif'>")
' str = replace(str, ";-)", "<img src='../html-images/2.gif'>")
' str = replace(str, ":D", "<img src='../html-images/3.gif'>")
' str = replace(str, ":-)", "<img src='../html-images/4.gif'>")
' str = replace(str, ":(", "<img src='../html-images/5.gif'>")
%>
<td class="text1" colspan="3" style="border-left-color: #000000; border-left-width: 1px; border-right-color: #000000; border-right-width: 1px; border-top-style: none; border-top-width: medium"><%=rsguestbook("beretning")%>
<br><br>
</td>
</tr>
</table>
</div>
<br>
<div align="center">
<table border='0' cellpadding='0' cellspacing='0' style='border-width:0px; border-collapse: collapse' width='530' id='table2' bordercolor='#000000'> <tr>
<td class=text1 align=center>
<a href='xtra/indtast_billede_tekst.asp?id=<%=lngRecordNo%>'>Upload flere billeder</a>
</td>
</tr>
</table>
<br>
<div align="center">
<table border='0' cellpadding='0' cellspacing='0' style='border-width:0px; border-collapse: collapse' width='530' id='table2' bordercolor='#000000'> <tr>
<td class=head align=center>
****************Det er her det skal sættes ind : ****************
<%
if rsguestbook.eof then
response.write "<b>ingen ekstra billeder</b>"
else
response.write "<b>Ekstra billeder</b>"
dim i
i = 0
%>
</td>
</tr>
</table>
<table border='0' cellpadding='0' cellspacing='4' style='border-width:0px; border-collapse: collapse' width='530' id='table2' bordercolor='#000000'>
<tr>
<%
'Loop through the recordset
Do While not rsGuestbook.EOF
%>
<td class=text1>
<a href="<%= rsguestbook("sti")%>" target=_blank>
<img src="<%= rsguestbook("sti")%>" border="0" height="<%= newheight %>" width="<%= newwidth %>" align="top">
</a>
<%= rsguestbook("tekst")%>
<%
If i = 3 then
response.write "</tr>"
response.write "<tr>"
i = 0
Else
i= i + 1
End If
'Move to the next record in the recordset
rsGuestbook.MoveNext
Loop
End if
'response.write "</tr>"
%>
</table>
</div>
</body>
</html>
</font><%
'Reset server objects
rsGuestbook.Close
Set rsGuestbook = Nothing
Set adoCon = Nothing
%>
