PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
itsmani1
Forum Regular
Posts: 791 Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:
Post
by itsmani1 » Tue Feb 08, 2005 3:16 am
hello people...
i m using php/mysql and i need help in qry:
in my DB the table has a date field with data type date and time
now i want to select those rows that are exectly one month old
any help plz.
Code: Select all
$qry "select date from table where date < one_month ";
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Tue Feb 08, 2005 3:23 am
itsmani1
Forum Regular
Posts: 791 Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:
Post
by itsmani1 » Tue Feb 08, 2005 3:44 am
oki thanks yaar hope it will work
patrikG
DevNet Master
Posts: 4235 Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK
Post
by patrikG » Tue Feb 08, 2005 3:44 am
Code: Select all
SELECT field FROM table WHERE CURDATE()<=date_end AND CURDATE()>=date_start
Good idea to read the manual, too.
itsmani1
Forum Regular
Posts: 791 Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:
Post
by itsmani1 » Tue Feb 08, 2005 5:17 am
SELECT * FROM tree
WHERE DATE_SUB(CURDATE(),INTERVAL 30 DAY) > 8/18/2004
can you tell me :
DATE_SUB(CURDATE(), => what is this
INTERVAL 30 DAY) => what is this
Regards
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Tue Feb 08, 2005 7:48 am
Subtract from CURDATE() (current date and time) ... 30 days.