PDA

View Full Version : date news system


reubenb
08-31-2006, 01:07 PM
hi.

i have a database with fields called 'title' and 'date'.

how can i do it so an asp script will go through the table and see the date and titles and list them accordingly (but there can be any date there... so no dates are hard coded)
example of a table is

Date Title
28/08/2006 Title1
28/08/2006 Title2
28/08/2006 Title3
22/08/2006 Title1
22/08/2006 Title2
22/08/2006 Title3

and i will see on my page:

28/08/2006
Title1
Title2
Title3

22/08/2006
Title1
Title2
Title3

thanks muchly

degsy
08-31-2006, 03:09 PM
You could use a nester recordset or just an if statement.


sql = "SELECT [date], [title] FROM news ORDER BY [date] DESC, [title]"



While NOT rs.EOF
If rs("date") <> d Then
Response.Write rs("date") & "<br>"
d = rs("date")
End If
Response.Write rs("title") & "<br>"
rs.MoveNext()
Wend