Do you need to know the next event from todays date ... and do you
have the date for each event in your database ... and do you want the
next event to be todays if there is one, or tomorrows.
you may have to ...
select eventDate, eventCollege, eventName, eventDesc from Events
where eventDate >= Date()
order by eventCollege desc, eventDate desc
I would use getrows, and throw this into an array ... or use my
dbconn.asp script on my site. The array would have the equivaent of 4
columns.
<%
Dim theCollege: theCollege = ""
For row = 0 to ubound(eventsArray,2)
If Not theCollege = eventsArray(1,n) Then
theCollege = eventsArray(1,n)
With Response
.Write "your code display for this record in the array"
End With
End If
%>
-See, the above code has an array.
-theCollege starts as nothin
-the array is ordered by college then by date
-this loop will go through the entire array and only write the first
record for the college ... which will be the one you need ... then it
won't write another until it is the next college.
See?
With more info on your DB structure, I may be able to narrow it down a
bit.
I THINK this will be a faster way than selecting top1 for each college
... that would be 6 hits to the database each time
PERSONALLY
I would create a text file ... first line with the date, then the next
6 lines with the html for the display of the "next events" ... I would
have a subroutine that ...
-checks to see if the date on the first line = today
-if not, goto code that rewrites the text file from the database to
update it
-else, show the text files html
THIS WOULD SAVE BIG TIME ON YOUR DATABASE
I am a MAJOR FREAK about not using the database if possible.
I would even suggest making that text file an asp file that is
included ...
<!-- #include virtual="/scripts/latestEvents.asp" -->
-if no date
-redirect to rewrite of asp inlclude that does the date check
-else
-nothing ... just show the below html
the include could be like...
<%
Dim theDate
theDate = "1/19/04"
If Not theDate = Date() Then
'// Rewrite this page .. must rewrite the below HTML and the value
for theDate variable to todays
Response.Redirect("thisPageRewriteUtility.asp")
End If
'// Else ... no action and it will simply display the html below this
%>
<tr><td>College</td><td>Event</td></tr>
<tr><td>College</td><td>Event</td></tr>
<tr><td>College</td><td>Event</td></tr>
<tr><td>College</td><td>Event</td></tr>
<tr><td>College</td><td>Event</td></tr>
<tr><td>College</td><td>Event</td></tr>
+++++++++++++++++++++++++++++==
This would cause the database to only be hit the first time by the
first user each day ... then would be static from here ... I have used
this technique several times, and it would definately be the fastest
way to have a dynamic, static page =) AND YOU NEED SPEED ...
especially since it is your home page we are talking about.
Brynn
www.coolpier.com
P.S. if you need further assistance, let me know ... if this sounds
too complicated, let me know and I may be able to help further or
write a quick couple of scripts. Contact me at the following link if
need be ...
http://www.coolpier.com/cp/developer/contact.asp
Brynn
www.coolpier.com
I participate in the group to help give examples of code.
I do not guarantee the effects of any code posted.
Test all code before use!