kwadman
09-08-2005, 04:20 PM
Hi, What i'm trying to do is display images by Catory
My database is a like the one below:
-------------------------------------
- Title - Image URL - Catory -
-------------------------------------
- Image1 - /i/1.jpg - Cat1 -
- Image2 - /i/2.jpg - Cat1 -
- Image4 - /i/3.jpg - Cat2 -
- Image5 - /i/4.jpg - Cat2 -
-------------------------------------
Now what i get on the output of my ASP is
Click me for Cat1
Click me for Cat1
Click me for Cat2
Click me for Cat2
You see all i want is one record of Cat1 and one of Cat2
I think i need to have a IF statement or somthing that says somthing like, If Cat1 is
already displayed then move to the next record and don't print Catory name until EOF.
Thats where i get stuck !!!
<<<<<<<<<<<< MY ASP CODE SO FAR IS >>>>>>>>>>>>>>>
<!--#include Virtual="/Style/Header.asp" -->
<center><table width="1" Height="50">
<%
set adorecordset = server.createobject("ADODB.Recordset")
sqlstring = "SELECT * FROM gallery"
adorecordset.open sqlstring,adoconnection
adorecordset.movefirst
while not adorecordset.eof
%>
<tr>
[<a href= "/Gallery.asp?cat=<%=adorecordset("cat")%>"><%=adorecordset("cat")%></a>]
</td>
</tr>
<%
adorecordset.movenext
wend
set adorecordset = nothing
%>
</table>
</center>
<!--#include Virtual="/Style/Footer.asp" -->
My database is a like the one below:
-------------------------------------
- Title - Image URL - Catory -
-------------------------------------
- Image1 - /i/1.jpg - Cat1 -
- Image2 - /i/2.jpg - Cat1 -
- Image4 - /i/3.jpg - Cat2 -
- Image5 - /i/4.jpg - Cat2 -
-------------------------------------
Now what i get on the output of my ASP is
Click me for Cat1
Click me for Cat1
Click me for Cat2
Click me for Cat2
You see all i want is one record of Cat1 and one of Cat2
I think i need to have a IF statement or somthing that says somthing like, If Cat1 is
already displayed then move to the next record and don't print Catory name until EOF.
Thats where i get stuck !!!
<<<<<<<<<<<< MY ASP CODE SO FAR IS >>>>>>>>>>>>>>>
<!--#include Virtual="/Style/Header.asp" -->
<center><table width="1" Height="50">
<%
set adorecordset = server.createobject("ADODB.Recordset")
sqlstring = "SELECT * FROM gallery"
adorecordset.open sqlstring,adoconnection
adorecordset.movefirst
while not adorecordset.eof
%>
<tr>
[<a href= "/Gallery.asp?cat=<%=adorecordset("cat")%>"><%=adorecordset("cat")%></a>]
</td>
</tr>
<%
adorecordset.movenext
wend
set adorecordset = nothing
%>
</table>
</center>
<!--#include Virtual="/Style/Footer.asp" -->