Hello every one,
i have a form with a date .i need to display records of the form from the database and display all records of 2 weeks from the present date i.e 14 days record..so how to get the date 14 days back from current date
Thanks,
Pradeep
5 2367 strtotime may hep you.
This is the sql command i am using.. i have put "??" for where i have doubt where i need to have a 14 day old date....how to get it i dont know.... -
SELECT
-
ID, raised, ext, location, description, type,
-
DATE_FORMAT(rdate,'%d %M %Y'),
-
action,status,
-
DATE_FORMAT(cdate,'%d %M %Y'),
-
remark,handle
-
FROM complaint
-
WHERE status='open' OR (rdate <= curdate() and rdate >= ??)
-
This is the sql command i am using.. i have put "??" for where i have doubt where i need to have a 14 day old date....how to get it i dont know....
$str_sql="select ID,raised,ext,location,description,type,DATE_FORMA T(rdate,'%d %M %Y'),action,status,DATE_FORMAT(cdate,'%d %M %Y'),remark,handle from complaint where status='open' or (rdate <= curdate() and rdate >= ?? )
What's the format of rdate?
Atli 5,058
Expert 4TB
Hi.
You can use the DATE_SUB function to do that. -
SELECT DATE_SUB(NOW(), INTERVAL DAYS 14)
-
Atli 5,058
Expert 4TB
I've merged the duplicate thread you posted in the PHP forums into this one.
Please don't double post your questions.
And please post you code inside [code] tags, preferably formatted in such a way that we can actually understand it.
Thanks
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Neil |
last post by:
Hi,
I hope this question isn't too far off topic....I'm almost at my wits
end trying to figure this out.
I have a Mysql database and I wish to automate the backup of the
database because I...
|
by: Fabrizio Tivano |
last post by:
Hello dear all,
i have 2 table :tbl1 and tbl2
i need to make an update on tbl1 based from tbl2 records.
Ex:
update tbl1, tbl2 set tbl1.conf='1' where tbl2.name='AD' and tbl2.date=tbl1.date;...
|
by: Philip Stoev |
last post by:
Hi all,
Please tell me if any of this makes sense. Any pointers to relevant
projects/articles will be much appreciated.
Philip Stoev
http://www.stoev.org/pivot/manifest.htm
...
|
by: - |
last post by:
what is the function to check whether a date, eg 2005-02-44, exists?
in php, there is a checkdate() function.
|
by: Phil Nospam |
last post by:
Hello all,
I was browsing through the reference manual on the mysql.com web site and
found the following code examples for some date/time functions:
mysql> SELECT STR_TO_DATE('00/00/0000',...
|
by: Sam Flywheel |
last post by:
Hello, all:
I am pleased to announce that the MySQL Journal is moving
forward. During the past two weeks, I've been discussing the journal
with MySQL AB, and the plan that's been devised...
|
by: Lennie De Villiers |
last post by:
Hi,
I'm running PHP 4.4.2 and mySQL on MS Windows XP Home Edition in IIS 6.0.
When I try to connect to mySQL from PHP I get the following error message:
Warning: mysql_connect(): Client does...
|
by: Chris Tate-Davies |
last post by:
Hello. I have a generic table used for many different generic
functions. the fields are mainly varchar's but one of these varchars
contains dates (in the format dd/mm/yyyy) for one reason or...
|
by: Atli |
last post by:
This is an easy to digest 12 step guide on basics of using MySQL. It's a great refresher for those who need it and it work's great for first time MySQL users.
Anyone should be able to get...
|
by: TC |
last post by:
Hi.
I have some ASP written in VB.net which is currently installed on a
customers server. The asp connects to a local MySql database and retrieves
data for the customers customers. If you see...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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...
|
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,...
|
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...
| |