Print Page | Close Window

HELP need help with listing records date

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=5090
Printed Date: 29 March 2026 at 9:49am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: HELP need help with listing records date
Posted By: AdultStarsMgr
Subject: HELP need help with listing records date
Date Posted: 17 August 2003 at 12:38pm

Pulling out my hair trying to get past date added to DB for listing
Plus trying to call image if date is within slotted number of days. I am tasked with this because of an unfinished project by someone else. ASP is a bit new to me. My code is below if anyone can suggest somethings.

set CatGirls = conntemp.execute("select thumb1, thumb2, thumb3, thumb4, thumb5, thumb6, thumb7, thumb8 from Categories where id = " & Category)

set CatName = conntemp.execute("select cat_name from Categories where id = " & Category)

<%
For x=0 to 7
If (CatGirls(x)) Then
set GirlName = conntemp.execute("select name, ad_title, incall, outcall, travel from Girls where id=" & CatGirls(x))
%>

<%
If (GirlName(2)) Then
%><img src="../images/icons/in.gif" alt="" width="11" height="30">
<%
End If

If (GirlName(3)) Then
%><img src="../images/icons/out.gif" alt="" width="11" height="30"><br>
<%
End If

If (GirlName(4)) Then
%><img src="../images/travel.gif" alt="" width="20" height="20">
<%
End If
%>



Here is where I want the the set made for new records within 20 days pulling from


<%
Top8String = Top8String & "," & CatGirls(x)
End If
Next
set RestOfGirls = conntemp.execute("select id, name, ad_title, incall, outcall, travel from Girls where active=1 AND id IN (select girl_id from CategoryGirl where cat_id = " & Category & ") order by id")

Do While Not RestOfGirls.eof
If (InStr(Top8String, RestOfGirls(0)) = 0) Then
%>
<%
If (RestOfGirls(3)) Then
%><img src="../images/icons/in.gif" alt="" width="11" height="30">
<%
End If
If (RestOfGirls(4)) Then
%><img src="../images/icons/out.gif" alt="" width="11" height="30"><br>
<%
End If
If (RestOfGirls(5)) Then
%><img src="../images/travel.gif" alt="" width="20" height="20">
<%
End If
%>

<%

End If

RestOfGirls.MoveNext
Loop

Set CatGirls = nothing
Set RestOfGirls = nothing

%>
</tr>
</table>
</body>
</html>

<%

Set CatGirls = Nothing
Set CatName = Nothing
CloseConnection

%>




Replies:
Posted By: pmormr
Date Posted: 17 August 2003 at 3:52pm

...
  



-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/


Posted By: AdultStarsMgr
Date Posted: 17 August 2003 at 5:22pm

Well, I am sorry for even posting such a question if I was that gifted dude. I thought this is where and why people come on here to share thoughts, help, etc. I must be wrong!

Just for your info, the code I put up works fine and all the strings, querries, and so on. So, maybe be a little more friendly, and less of a smart ass to be blunt here. If you would of read the beginning text of why and where I am on this thing instead of going to the code, you might of been a little less of an ass but then again, maybe not! Maybe I just came to the wrong board to be frank!

Happy Expert Coding ! 



Posted By: b_bonnett
Date Posted: 17 August 2003 at 5:25pm

What field in your database holds the date? I can't see any in the SQL you have got there.

Blair



-------------
Webmaster, http://www.planegallery.net/ - The Plane Gallery
Greetings From Christchurch


Posted By: pmormr
Date Posted: 17 August 2003 at 5:43pm

It really sucks that your stuck in this position. I'm sorry if i came over as an asshole. Please post the entire code, clarify what your trying to do, and i'll be happy to fix it for you.



-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/


Posted By: pmormr
Date Posted: 17 August 2003 at 5:45pm
If you don't mind me asking, what kind of site are you writing this code for?

-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/


Posted By: AdultStarsMgr
Date Posted: 17 August 2003 at 5:51pm

Thats cool! I have no problem. But I have been trying several things for the last 2 days with this. I actually wanted to have the latest 20 days of NEW records open in the main index page but I will settle for it with the top header as the code attached is for.

*** This site works off of a side navigator, top scrolling navigator, bottom footer, and a main index page. So, it is not as easy as one may think or is it just me!!!

Code below for record list which also ties in with the main index when clicked, and ctrings from a category listing.

<%

Category = Request.ServerVariables("QUERY_STRING")

%><!--#include virtual="/include/Connection.asp"--><%

Dim Conntemp
OpenConnection

'set CatGirls = conntemp.execute("select id, name from Girls G, CategoryGirl CG where G.active=1 and G.id=CG.girl_id and CG.cat_id = " & Category)
set CatGirls = conntemp.execute("select thumb1, thumb2, thumb3, thumb4, thumb5, thumb6, thumb7, thumb8 from Categories where id = " & Category)
set CatName = conntemp.execute("select cat_name from Categories where id = " & Category)
%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
@import url("/ccs/css_tophead.css");
-->
</style>
</head>

<body bgcolor="#FFCC00" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table border="1" cellpadding="0" cellspacing="1" bordercolor="#003366" bgcolor="#003399"><!--DWLayoutTable-->
  <tr>
    <%

For x=0 to 7
 If (CatGirls(x)) Then
  set GirlName = conntemp.execute("select name, ad_title, incall, outcall, travel from Girls where id=" & CatGirls(x))
%>
    <td valign="top">
      <table border="0" cellpadding=1 cellspacing=2 bordercolor="#0033CC">
        <tr>
          <td colspan=2 align=center valign="top" nowrap bgcolor="#660099"><font size="2" face="Arial, Helvetica, sans-serif"><a href="girldetail.asp?girl=<%=CatGirls(x)%>&pic=1&cat=<%=Category%>" target="mainFrame"><strong><%=GirlName(0)%></strong></a></font></td>
        </tr>
        <tr>
          <td bgcolor="#660099"><a href="girldetail.asp?girl=<%=CatGirls(x)%>&pic=1&cat=<%=Category%>" target="mainFrame"><img src="/pictures/<%=CatGirls(x)%>/thumbs/1.jpg" alt="" border=0 align="absmiddle"></a></td>
          <td align="right" nowrap bgcolor="#660099">            <%
  If (GirlName(2)) Then
   %>            <img src="../images/icons/in.gif" alt="" width="11" height="30">            <%
  End If

  If (GirlName(3)) Then
   %>            <img src="../images/icons/out.gif" alt="" width="11" height="30"><br>           
            <%
  End If

  If (GirlName(4)) Then
   %>            <img src="../images/travel.gif" alt="" width="20" height="20">            <%
  End If
%>
          </td>
        </tr>
        <tr>
          <td colspan=2 align=center nowrap bgcolor="#FFCC00"><font color="#0000FF" face="Arial, Helvetica, sans-serif" size="-2"><b><%=GirlName(1)%></b></font></td>
        </tr>
      </table>
    </td>
    <td valign="top" bgcolor="#0066CC">&nbsp;</td>
    <%
    Top8String = Top8String & "," & CatGirls(x)
    End If

Next

set RestOfGirls = conntemp.execute("select id, name, ad_title, incall, outcall, travel from Girls where active=1 AND id IN (select girl_id from CategoryGirl where cat_id = " & Category & ") order by id")

Do While Not RestOfGirls.eof

 If (InStr(Top8String, RestOfGirls(0)) = 0) Then

%>
    <td valign="top"><table border="0" cellpadding=1 cellspacing=2>
        <tr bgcolor="#660099">
          <td colspan=2 align=center valign="top" nowrap><font size="2" face="Arial, Helvetica, sans-serif"><a href="girldetail.asp?girl=<%=RestOfGirls(0)%>&pic=1&cat=<%=Category%>" target="mainFrame"><strong><%=RestOfGirls(1)%></strong></a></font></td>
        </tr>
        <tr>
          <td nowrap bgcolor="#660099"><a href="girldetail.asp?girl=<%=RestOfGirls(0)%>&pic=1&cat=<%=Category%>" target="mainFrame"><img src="/pictures/<%=RestOfGirls(0)%>/thumbs/1.jpg" alt="" border=0 align="absmiddle"></a></td>
          <td align="right" nowrap bgcolor="#660099">            <%
  If (RestOfGirls(3)) Then
   %>            <img src="../images/icons/in.gif" alt="" width="11" height="30">            <%
  End If

  If (RestOfGirls(4)) Then
   %>            <img src="../images/icons/out.gif" alt="" width="11" height="30"><br>           
            <%
  End If

  If (RestOfGirls(5)) Then
   %>            <img src="../images/travel.gif" alt="" width="20" height="20">            <%
  End If
%>
          </td>
        </tr>
        <tr bgcolor="#FFCC00">
          <td colspan=2 align=center nowrap bordercolor="#FFCC00"><font color="#0000FF" face="Arial, Helvetica, sans-serif" size="-2"><b><%=RestOfGirls(2)%></b></font></td>
        </tr>
   &nb



Posted By: pmormr
Date Posted: 17 August 2003 at 5:56pm
so let me get this straight, you want the records that are dated within the last 20 days to be displayed?

-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/


Posted By: AdultStarsMgr
Date Posted: 17 August 2003 at 6:03pm

Yes, there is a RS for each new addition that is in the db girls. The table is : date_added which is date f0rmated when submission accurs.

Besides that, how do you call an image displayed when triggered by an date in time. IE: all listings within 7 days get a special NEW gif or star, or whatever. Easy doing true/false - stuff but this was impossible to figure out with me.



Posted By: pmormr
Date Posted: 17 August 2003 at 6:10pm

Very simply, you would store you image filename (and path) in a database field. When that particular record is called, you would pull the filename of the image and put it into an img html tag. See below:

'Image filename is located in a field named (example) 'imgfn'
imgfn = recordset.fields("imgfn")
Response.Write("<img src=""" & imgfn & """>"



-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/


Posted By: AdultStarsMgr
Date Posted: 17 August 2003 at 6:14pm

That would work! I am stunned here of why it could not be used on the others I have pulled up as well. I will check this out.

BRB



Posted By: AdultStarsMgr
Date Posted: 17 August 2003 at 6:24pm
Ok, but that is what I mean by the date_added< getdate>> problem I am having because how do I trigger that RS. I want to have this trigger happening site wide and not only on this particular page I am working on.


Posted By: pmormr
Date Posted: 17 August 2003 at 6:28pm

then write it into a different file, and include it into your other pages when you need it.



-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/


Posted By: AdultStarsMgr
Date Posted: 17 August 2003 at 6:42pm

Ok, but that is lesser of my headaches now, the date thing for the page talked about is the problem. NOw, what do you think about this for adding headaches. Since my categorys are manually added in a admin panel, can it be put into the categories automatically by an RS?  This might fixed the problem if so be it. Here is the code in the update recordset:

<table align=left>
                  <%
  set Categories = conntemp.execute("select id, cat_name from Categories order by cat_name")

  Do While Not Categories.eof
   set AlreadyChecked = conntemp.execute("IF EXISTS (SELECT * FROM CategoryGirl WHERE cat_id = " & Categories(0) & " AND girl_id = " & ID & ") SELECT 1 ELSE SELECT 0")
   If (AlreadyChecked(0) = 1) Then
   %>
                  <tr>
                    <td align=left><input type="checkbox" class="btnbig" name="<%=Categories(0)%>" checked>
                        <%=Categories(1)%></td>
                  </tr>
              <%
            Else
   %>
                  <tr>
                    <td align=left><input type="checkbox" class="btnbig" name="<%=Categories(0)%>">
                        <%=Categories(1)%></td>
                  </tr>
              <%
            set AlreadyChecked = nothing
            End If
        Categories.MoveNext
  Loop
%>
                </table>



Posted By: pmormr
Date Posted: 17 August 2003 at 6:48pm

I would be able to help you better if i had written the code myself. I think it would be easier to just manually added the catagories yourself unless you have to.



-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/


Posted By: AdultStarsMgr
Date Posted: 17 August 2003 at 6:56pm

The categories are choosen by the person which is an radio button. I just wish there was a way to filter the categories to list in another category that is 20 days or newer. Does that explain it more.

I have an add category in the admin panel for future add ons too.



Posted By: michael
Date Posted: 17 August 2003 at 7:01pm
Ay, I deleted your website out of your profile as it contained a link to an adult site containing nudity. Please do not post a link to your site here as this site is visited by minors.
Thanks

-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker


Posted By: pmormr
Date Posted: 17 August 2003 at 7:06pm

so you want to filter catagories that are 20 days or newer two... in your admin panel set the date along with the new catagory. When you open your database in your catagory page, add something like my jokes site example select statement, you should get a good idea from this,

   Dim lm
   lm = Dateadd("m", -1, date())
  
   'Open connection to database
   Dim conn
   Set conn = Server.CreateObject("ADODB.Connection")
   conn.provider = "Microsoft.Jet.OLEDB.4.0"
   conn.open "c:\mfolder\accesslevel1\jokesdatabase.mdb"
  
   'Create Recordset
   Dim rs
   Set rs = Server.CreateObject("ADODB.RecordSet")
   rs.open "SELECT * FROM list WHERE additiondate >= #" & lm & "#", conn

this piece of code displays all the records added within the last month, the additiondate is located in the field 'additiondate' in my jokes database...



-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/


Posted By: pmormr
Date Posted: 17 August 2003 at 7:09pm

the dateadd function is called on to subtract one month from today's date and write out that date. You could probably modify that function to read 'dateadd("d", -20, date())'



-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net