navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

Date Range Search Using MySQL

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> Date Range Search Using MySQL
Page: [1]
 
sentinel

 

Posts: 566
Joined: 5/4/2005
From: Chicago, Illinois
Status: offline

 
Date Range Search Using MySQL - 10/26/2005 14:51:05   
hey all...

I have a form page with 2 fields. StartDate and EndDate

i have a FPDRW on the spooky diet that is fed from those two fields.

I have the form page submitting to itself because the fpdrw is right below the form fields.

When i try to pass it start and end dates it does not do anything.

The field datatype i am using is DATE.

Here is my code

<form method="POST" action="hc_super_call_log_main2.asp">
              <p align="center">
              <input type="text" name="startdate" size="20">
              <input type="text" name="enddate" size="20"></p>
              <p align="center"><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
            </form>
            <table width="100%" border="1" height="94">
              <thead>
                <tr>
                  <td height="19"><b>datetime</b></td>
                </tr>
              </thead>
              <tbody>
                <!--#include file="_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
                </SCRIPT>
<% end if %>
<%
fp_sQry="SELECT datetime FROM hc_call_log  WHERE datetime Between '"  & request.form("datetime" ) & "'   And  '" & request.form("datetime" ) & "' "
fp_sDefault=""
fp_sNoRecords="<tr><td colspan=1 align=left width=""100%"">No records returned.</td></tr>"
fp_sDataConn="Database1"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice="datetime"
fp_sMenuValue="datetime"
fp_sColTypes="&datetime=133&"
fp_iDisplayCols=1
fp_fCustomQuery=True
BOTID=2
fp_iRegion=BOTID
%>
<!--#include file="_fpclass/fpdbrgn1.inc"-->
<tr>
                  <td height="19">
                  <%=FP_FieldVal(fp_rs,"datetime")%></td>
                </tr>
                <!--#include file="_fpclass/fpdbrgn2.inc"-->


Any ideas?

_____________________________

No matter where you go, there you are.
rdouglass

 

Posts: 9202
From: Biddeford, ME USA
Status: offline

 
RE: Date Range Search Using MySQL - 10/26/2005 15:15:42   
quote:

fp_sQry="SELECT datetime FROM hc_call_log WHERE datetime Between '" & request.form("datetime" ) & "' And '" & request.form("datetime" ) & "' "


Not sure but datetime may be a reserved word. Have you tried something like this:

fp_sQry="SELECT [datetime] FROM hc_call_log WHERE [datetime] Between '" & request.form("datetime" ) & "' And '" & request.form("datetime" ) & "' "


_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to sentinel)
sentinel

 

Posts: 566
Joined: 5/4/2005
From: Chicago, Illinois
Status: offline

 
RE: Date Range Search Using MySQL - 10/26/2005 15:33:11   
Putting the datetime in [datetime] generates an error.

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[datetime] FROM hc_call_log WHERE datetime Between '10/21/2005' And '10/26/2005'' at line 1

_____________________________

No matter where you go, there you are.

(in reply to rdouglass)
sentinel

 

Posts: 566
Joined: 5/4/2005
From: Chicago, Illinois
Status: offline

 
RE: Date Range Search Using MySQL - 10/26/2005 15:37:12   
I removed the [ ] and it works awesome!

The only problem is that when I go to submit the start and end dates i need to use this format

YYYY-MM-DD

is there anyway to make it MM/DD/YYYY ?

_____________________________

No matter where you go, there you are.

(in reply to sentinel)
rdouglass

 

Posts: 9202
From: Biddeford, ME USA
Status: offline

 
RE: Date Range Search Using MySQL - 10/26/2005 15:47:51   
I think you can with the GET_FORMAT (DATE, 'USA') command. See:

http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to sentinel)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> Date Range Search Using MySQL
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts