Author |
Topic |
|
VodkaFish
Average Member
USA
654 Posts |
Posted - 10 July 2002 : 00:04:34
|
Hi, I'm looking to do something pretty simple, but quite frankly - I'm not good with dates in ASP yet.
I'm just looking to get a simple sql statement, list my data and go to the next day 7 times. I don't need reply dates or anything, just the info from FORUM_TOPICS.
The output would be simple:
July 9, 2002 Topic Topic Topic
July 8, 2002 Topic Topic Topic
July 7, 2002 Topic Topic Topic
Can anyone give me a push on this? Once I see this, I should be able to figure out my date problem as well (meaning I'll hopefully finally see some simple example and just say "oh...") Thanx!
v ø d k â f ï § h |
|
ruirib
Snitz Forums Admin
Portugal
26364 Posts |
Posted - 10 July 2002 : 07:09:14
|
strSql = "SELECT * FROM " & strTablePrefix & "TOPICS WHERE T_DATE<'" & DateToStr(dateadd("d",-7,Now())) & "' ORDER BY T_DATE DESC;"
I guess this should do it, to create your SQL statement. For this to work you'll need to include inc_functions.asp in the file.
This should get you started. Now you can create a recordset based in it and start to do some record processing.
------------------------------------------------- Installation Guide | Do's and Dont's | MODs
Edited by - ruirib on 10 July 2002 07:12:08 |
|
|
VodkaFish
Average Member
USA
654 Posts |
Posted - 10 July 2002 : 11:47:39
|
This definitely got me on the right track. Just had to flip the < to a >. Here's a question, everytime I make it = I get an error. I can't equal a date? I was hoping to do this as I want to group the topics by date, and right now I can just list the topics with the dates.
Thanx so far, it's helped a lot.
v ø d k â f ï § h |
|
|
ruirib
Snitz Forums Admin
Portugal
26364 Posts |
Posted - 10 July 2002 : 12:48:45
|
quote:
This definitely got me on the right track. Just had to flip the < to a >.
Of course, my mistake, sorry.
quote:
Here's a question, everytime I make it = I get an error. I can't equal a date? I was hoping to do this as I want to group the topics by date, and right now I can just list the topics with the dates.
What error do you get? Maybe a BOF or EOF? It's very difficult to get a match with a date, because the T_DATE column has not only the date, but also a hours, minutes and seconds, and it's very hard to have to posts made at the exact same time.
If you want posts for a given date, you probably need something like T_DATE >= 'YYYYMMDD000000' AND T_dATE<='YYYYMMDD235959'
Another (better option, IMO) is do it in code. As the records are in descending order, get the complete date for the first topic, extract the month and day, show this indo and show the topic. Get the next topic, get the month/day, if equal to previous, show the topic, if not show the new day/month and the topic, and so on..., until you get to the last record. Get the idea?
------------------------------------------------- Installation Guide | Do's and Dont's | MODs |
|
|
|
Topic |
|
|
|