Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Images in a databae
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Images in a databae

 Post Reply Post Reply Page  12>
Author
288enzo View Drop Down
Groupie
Groupie
Avatar

Joined: 28 April 2003
Location: United States
Status: Offline
Points: 61
Post Options Post Options   Thanks (0) Thanks(0)   Quote 288enzo Quote  Post ReplyReply Direct Link To This Post Topic: Images in a databae
    Posted: 01 May 2003 at 11:45am

I am very new at this and am not even sure how to explain this.

I have a database that has the ID number that never duplicates.

I have no problem accessing the database and viewing information.

What it is that I would like to do is the following:

I have a directory named /images

And in the directory are jpeg’s that are numbered.  The numbers correspond with the database ID numbers.

How can I view my database and on the same line as ID 50 view the file 50.jpg?

Does this make sense?

Thanks for the help.

Back to Top
ultramods View Drop Down
Groupie
Groupie
Avatar

Joined: 08 January 2003
Location: Scotland
Status: Offline
Points: 146
Post Options Post Options   Thanks (0) Thanks(0)   Quote ultramods Quote  Post ReplyReply Direct Link To This Post Posted: 01 May 2003 at 1:22pm

sql= "select ID from table where ID= 50"

<% response.write("<img src=""" & "picFolder/" & rs("ID") & ".jpg""" &  "width='300' height='200' align='center' >")%>

Back to Top
288enzo View Drop Down
Groupie
Groupie
Avatar

Joined: 28 April 2003
Location: United States
Status: Offline
Points: 61
Post Options Post Options   Thanks (0) Thanks(0)   Quote 288enzo Quote  Post ReplyReply Direct Link To This Post Posted: 01 May 2003 at 2:13pm

I got that, I guess I didn't explain well enough.

When you view database.asp you will get a table that lists all data in the database.  The first column in a generic image.  What I would like to do is:

click on the generic image and have the true image open in another window.  the true image's file name would be the "ID number".jpg

meaning on row 45 would could click on the generic image and have image 45.jpg or whatever the id might be for rouw 45 open in a new window.

I know that this is much more complicated, that is why I am here asking questions.

Thanks for the quick reply.

Back to Top
ultramods View Drop Down
Groupie
Groupie
Avatar

Joined: 08 January 2003
Location: Scotland
Status: Offline
Points: 146
Post Options Post Options   Thanks (0) Thanks(0)   Quote ultramods Quote  Post ReplyReply Direct Link To This Post Posted: 01 May 2003 at 2:38pm

Is this what you mean.

----------------------page 1------------------------

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->
</script>
</head>

<body bgcolor="#FFFFFF" text="#000000">
<%
'Execute your sql statement.

while not rs.EOF
RESPONSE.WRITE("<img src=""generic.jpg"" width=""200"" height=""150"" onClick=""MM_openBrWindow('specificpic.asp?picID=" & rs("ID") & "','Picture','width=200,height=200')""> ")

rs.movenext
wend
%>
</body>
</html>
----------------------end page 1------------------------

----------------------pop-up page------------------------

<%
OPTION EXPLICIT

Dim pic

pic = Trim(Mid(Request.QueryString("picID"), 1, 8))
%>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000">

<% response.write("<img src=""" & "picFolder/" & pic & ".jpg""" &  "width='300' height='200' align='center' >")%>

</body>
</html>

Back to Top
288enzo View Drop Down
Groupie
Groupie
Avatar

Joined: 28 April 2003
Location: United States
Status: Offline
Points: 61
Post Options Post Options   Thanks (0) Thanks(0)   Quote 288enzo Quote  Post ReplyReply Direct Link To This Post Posted: 01 May 2003 at 2:46pm

Damn your fast, I have no idea how you did that so quickly and precise.  Your a genius.

Thanks much.  You should have more than 2 stars under your name!!!

Back to Top
288enzo View Drop Down
Groupie
Groupie
Avatar

Joined: 28 April 2003
Location: United States
Status: Offline
Points: 61
Post Options Post Options   Thanks (0) Thanks(0)   Quote 288enzo Quote  Post ReplyReply Direct Link To This Post Posted: 02 May 2003 at 12:07am
Ok, I just go around to trying it out and came up with the following problem. A pop up window does not open, actually nothing opens.

The following is my page:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>OC Beach Rentals</title></head>
<script language="JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
     window.open(theURL,winName,features);
     }
//-->
</script>
</head>
<body>
<%
Dim adoCon                
Dim rsListings          
Dim strSQL               
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)};pwd=; DBQ=" & Server.MapPath("/database/ocbeachrentals.mdb")
Set rsListings = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT tblListings.ID, tblListings.Location, tblListings.Rent, tblListings.Image FROM tblListings;"
rsListings.Open strSQL, adoCon
Do While not rsListings.EOF
%>     
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="310" id="AutoNumber1" height="20">
<tr><td width="30" align="center" height="20">
<%     Response.Write ("<img src=""..\images\camera.jpg"" width=""30"" height=""20"" onClick=""MM_openBrWindow('pic.asp?picID=" & rsListings("ID")& "','Picture',width=200,height=200')"">")%>
</td>
<td width="30" align="center" height="20">
<%     Response.Write ("<a href=""delete_entry.asp?ID=" & rsListings("ID") & """>")
Response.Write (rsListings("ID"))
Response.Write ("</a") %> </td>
<td width="150" colspan="2" height="20">
<%     Response.Write (rsListings("Location")) %>  </td>
<td width="100" align="center" height="20">
<%     Response.Write (rsListings("Rent")) %>  </td>
<%
rsListings.MoveNext
Loop
rsListings.Close
Set rsListings = Nothing
Set adoCon = Nothing
%>
</table>
</body>
</html>

And the following is the pop up:

<%
OPTION EXPLICIT
Dim pic
pic = Trim(Mid(Request.Query.String("picID"), 1, 8))
%>
<html>
<head>
<title>Pic</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<% response.write("img src=""" & "/images/" & pic & ".jpg""" & "width='300'height='200'align='center'>")%>
</body>
</html>

Any ideas?

Thanks again, you have been a great help. I'm actually beginning to understand some of this.
Back to Top
ultramods View Drop Down
Groupie
Groupie
Avatar

Joined: 08 January 2003
Location: Scotland
Status: Offline
Points: 146
Post Options Post Options   Thanks (0) Thanks(0)   Quote ultramods Quote  Post ReplyReply Direct Link To This Post Posted: 02 May 2003 at 4:50am

Change the parts in bold, on you main page.

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>OC Beach Rentals</title></head> ---remove this
<script language="JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
     window.open(theURL,winName,features);
     }
//-->
</script>
</head>
<body>
.........................................

onClick=""MM_openBrWindow('pic.asp?picID=" & rsListings("ID")& "','Picture',  '   width=200,height=200')"">")%>

Back to Top
288enzo View Drop Down
Groupie
Groupie
Avatar

Joined: 28 April 2003
Location: United States
Status: Offline
Points: 61
Post Options Post Options   Thanks (0) Thanks(0)   Quote 288enzo Quote  Post ReplyReply Direct Link To This Post Posted: 02 May 2003 at 9:14am

Great - the pop up pops up.  In the pop up window I get the following error:

Microsoft VBScript runtime error '800a01b6'

Object doesn't support this property or method: 'Request.Query'

/guest/pic.asp, line 4

This is my pop up:

<%
OPTION EXPLICIT
Dim pic
pic = Trim(Mid(Request.Query.String("picID"), 1, 8))
%>
<html>
<head>
<title>Pic</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<% response.write("img src=""" & "../images/" & pic & ".jpg""" & "width='300'height='200'align='center'>")%>
</body>
</html>

Thanks again.  Are you really from Scotland?

Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.