Hi, If anyone has any pointer as to how to do this that would be great. This code gets me a list of categories only where they have artists listed in them. Instead of displaying the "category name" from tblcategories I want to change " & rs("Categorynam e") & " to a <src=""" & rs("pictureurl" ) & """> and display only one artist image from each category "pictureurl ". That could be a random artist picture or simply the first or last added in that category. In my artists table each listed artist has artistid categoryid and pictureurl.
So I need something like
select only one image from each category and display them as the number of categories active
Hope that makes sence for someone.
Thanks for any help
Richard
So I need something like
select only one image from each category and display them as the number of categories active
Code:
<%
On Error Resume Next
'set database connection
Set conn=Server.CreateObject("ADODB.Connection")
conn.Mode = 3 '3 = adModeReadWrite
conn.Open ConnectString
strSQL="SELECT tblCategories.CategoryID, tblCategories.CategoryName "
strSQL=strSQL & " FROM tblCategories INNER JOIN tblartists ON "
strSQL=strSQL & " tblCategories.CategoryID = tblartists.CategoryID "
strSQL=strSQL & " GROUP BY tblCategories.CategoryID, tblCategories.CategoryName"
strSQL=strSQL & " Order By tblCategories.CategoryName ASC "
Set rs=conn.Execute(strSQL)
Do While Not rs.EOF
Response.Write "<a href=""gallery5.asp?categoryid=" & rs("Categoryid") & """>" & rs("Categoryname") & "</a>"
rs.MoveNext
Loop
rs.Close
Set rs=Nothing
conn.Close()
Set conn=Nothing
%>
Hope that makes sence for someone.
Thanks for any help
Richard
Comment