473,545 Members | 1,878 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem using curdate() with mysql ?

Hi,

I have an asp page running from a mysql db.
A line in my asp code runs as follows:

.........WHERE ShipDate >= curdate()

This displays the data until 'shipdate' (from the database) is less
than curdate(). The problem I have is that I need the data to appear
until 7 days after the shipdate. I have tried things like curdate()+7,
but this does not work. I have also tried Shipdate+7, but this returns
incorrect records from the past ?
Appreciate your help

David
Jul 19 '05 #1
3 9883
da***@scene-double.co.uk (David) wrote in message news:<c1******* *************** ****@posting.go ogle.com>...
Hi,

I have an asp page running from a mysql db.
A line in my asp code runs as follows:

........WHERE ShipDate >= curdate()

This displays the data until 'shipdate' (from the database) is less
than curdate(). The problem I have is that I need the data to appear
until 7 days after the shipdate. I have tried things like curdate()+7,
but this does not work. I have also tried Shipdate+7, but this returns
incorrect records from the past ?


You can't trust returned date values from non-valid input.
You probably want someting like
DATEADD("2000-12-01",INTERVAL 7 DAY)

Also see:
http://www.mysql.com/doc/en/Date_and...functions.html

Bart
Jul 19 '05 #2
da***@scene-double.co.uk (David) wrote in message news:<c1******* *************** ****@posting.go ogle.com>...
Hi,

I have an asp page running from a mysql db.
A line in my asp code runs as follows:

........WHERE ShipDate >= curdate()

This displays the data until 'shipdate' (from the database) is less
than curdate(). The problem I have is that I need the data to appear
until 7 days after the shipdate. I have tried things like curdate()+7,
but this does not work. I have also tried Shipdate+7, but this returns
incorrect records from the past ?


You can't trust returned date values from non-valid input.
You probably want someting like
DATEADD("2000-12-01",INTERVAL 7 DAY)

Also see:
http://www.mysql.com/doc/en/Date_and...functions.html

Bart
Jul 19 '05 #3
da***@scene-double.co.uk (David) wrote in message news:<c1******* *************** ****@posting.go ogle.com>...
Hi,

I have an asp page running from a mysql db.
A line in my asp code runs as follows:

........WHERE ShipDate >= curdate()

This displays the data until 'shipdate' (from the database) is less
than curdate(). The problem I have is that I need the data to appear
until 7 days after the shipdate. I have tried things like curdate()+7,
but this does not work. I have also tried Shipdate+7, but this returns
incorrect records from the past ?


You can't trust returned date values from non-valid input.
You probably want someting like
DATEADD("2000-12-01",INTERVAL 7 DAY)

Also see:
http://www.mysql.com/doc/en/Date_and...functions.html

Bart
Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2033
by: Jan Nordgreen | last post by:
I use php4 and winxp. This query works as expected: $result = mysql_query(" SELECT feventid, UNIX_TIMESTAMP(fdate) as fdate, ftitle, fpostedby, fdetails, factive, UNIX_TIMESTAMP(fpostdate) as fpostdate FROM events WHERE fdate between '$datefrom' and '$dateto'
0
1402
by: David | last post by:
Hi, I have an ASP app running via our MySQL server. On one of my .asp pages I have an sql string as follows: .......WHERE ShipDate >= curdate()-7 This worked great up until the end of yesterday pulling up all records from last week (Todays date minus 7 days). Now we are in October, for some reason, this has stopped working, so my page...
1
6101
by: John Rappold | last post by:
I've Googled this, but can't find an answer to my problem. When a user selects a page with the recordset I want it to list dates that fall into a certain range, related to CURDATE(). The range fields are start_date and end_date, which are both DATETIME column types. Using BETWEEN won't work because it won't list a date that starts BEFORE...
2
5213
by: Ben | last post by:
Hi, I have a problem with this query: $link = mysql_connect("localhost", "root", "pw"); $dbsel = mysql_select_db('mydb', $link); $lol='bibi'; $sql = "select count(*) as totuur from studres where where dag>= curdate()
0
1699
by: nrip | last post by:
Dear All, I am facing a very peculiar problem. I am reading a CSV file from my JSP code and trying to insert them into MYSQL database. the program first reads a line and then splits it into words using the split function and then inserts them into different fields of the database. But the problem is that the JSP ; token=line.split(" ");...
9
2570
by: tshad | last post by:
This was posted before but the message got messed up (all NLs were stripped out for some reason). I have 2 labels that hold the name of different images on my .aspx page. <asp:Label ID="Logo" runat="server"/> <asp:Label ID="CompanyPicture" runat="server"/> I have 2 links that open the windows to preview these images. The previewed...
6
3145
by: kyandebishop | last post by:
Hello everybody. I took database course two years ago and I am having a serious problem. I created a table called pet with mySQL 5.0 and it has 6 fields. Among them are two fields for birth Date and death Date. When inserting the data I have one pet born today. I am trying to query the pet who was born today but it is not working. Here is my...
1
6302
by: JFKJr | last post by:
Hello everyone, the following Access VBA code opens an excel file and creates textboxes in a given range of cells dynamically. The code attaches "MouseUP" and "Exit" events to the textboxes (using the following "DateTextBox" class module). Whenever a user enters in to the textbox, the code displays "Please enter date in mm/dd/yyyy format (for...
2
2315
by: Steve | last post by:
Hi, I'm trying to write an SQL statement that provides a list of insurance/ product groups and then lists a total and percentage on the same line e.g. XX 5 4 80% XY 10 5 50% I can get the first 3 columns done ok but can't do the percentage.
0
7416
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7676
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7932
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
5347
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4965
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3473
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3456
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1032
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
729
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.