I have a databse that users can search and I would like to be able to display a picture in one of the fields right now is just displays text.
Can someone help please..
This works for me. I have an Access database with a field marked Pictures where I will put like 12345.jpg as the data text. In the ASP I have the following.
I use this code to get info from database where would i add picture link or what would i type in database
the filed is Pic
Dim SqlJunk
Set dbGlobalWeb = Server.CreateObject("ADODB.Connection"
dbGlobalWeb.Open("Members"
SqlJunk = "SELECT * FROM Members"
If Request.Form("TypeSearch" = "UserID" Then
SqlJunk = SqlJunk & " WHERE UserID LIKE '%" & Request.Form("DaInBox" & "%'"
End If
If Request.Form("TypeSearch" = "Pic" Then
SqlJunk = SqlJunk & " WHERE Pic LIKE '%" & _
Request.Form("DaInBox" & "%'"
End If
Set rsGlobalWeb = Server.CreateObject("ADODB.Recordset"
rsGlobalWeb.Open SqlJunk, dbGlobalWeb, 3
%>
<%
If rsGlobalWeb.BOF and rsGlobalWeb.EOF Then%>
<%
Do While Not rsGlobalWeb.EOF
%>
<tr bgcolor="#CCCCCC">
<td width="15%"><font color="#000000"><%=rsGlobalWeb("UserID"%></font></td>
<td width="14%"><font color="#000000"><%=rsGlobalWeb("Pic"%></font></td>
im using access2000 you cannot get to the page as its in a members section
I already use this to display the text can i not point the database to a picture
Sorry if im confusing the matter I just want a little gif to appear instead of the text.
normally you would put a picture file name here, but we put in the asp of
< %=(rsInventory.Fields.Item("Picture".Value)%>">
In your case, lets say you named a picture test.jpg and your access field name for pictures is "Pic" and the test.jpg is located in your images directory.
Your source code would then be:
< img src="../images/<%=(rsGlobalWeb.Fields.Item("Pic".Value)%>">
(remove the space between the first < and img)
The above will work if you have one specific ALT tag for every picture. If you would like the Alt to change with the picture then you can have a separate field in your database, say you call it ALT. you would be something like the following code.
On a different note I have some code that someone wrote for me which is not quite working right and he doesnt seem to know whats wrong.
Its pretty complicated "well for me at least"
What happens is on my site people log in and go to a members section .let me go back When they join all their info gets put into this database and it all works ok .
At which point they can now search the database for other members and look at some of that members info..
Well I want the members to be able to change some of their info but obviously they should only be able to change thier info.
So when they log in i create a session and this is where the guys code is supposed to work but doesnt.
would you be interested in taking a look at it ?
It consists of 4 pages and the database..
I understand if you dont want to.
Thanks for all your help
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.