|
-
Jun 21st, 2002, 01:43 PM
#1
Thread Starter
Member
Query!
What replaces the italicized junk in this statement?
Code:
SELECT * FROM messages WHERE date is 30 days old or more
-
Jun 21st, 2002, 01:59 PM
#2
PowerPoster
depends on the format of date in your table
-
Jun 21st, 2002, 02:01 PM
#3
Thread Starter
Member
-
Jun 23rd, 2002, 07:57 PM
#4
Thread Starter
Member
-
Jun 24th, 2002, 09:59 AM
#5
uhhggg I hate timestamps. makes things more difficult to chekc like you are doing.
you could try to compare it to the current timestamp on the box. this is one way of doing it.
PHP Code:
// this will get the current time form the server and then make it
//so it looks 30 days old. then you will need to get the timestamp
// form the DB and convert it as well.
$dy = date("d");
$mn = date("m");
$yr = date("Y");
$lat = 30;
$expiredate = strftime("%Y.%m.%d", mktime(0,0,0,$mn,$dy-$lat,$yr));
//then after you get the time form the DB and convert it
// you can compare the 2, if equal then you do what you wanted to.
-
Jun 24th, 2002, 10:17 AM
#6
Thread Starter
Member
Timestamps are excellent for the project I'm working on though.
And cheeky monkey, will try that
-
Jun 24th, 2002, 12:18 PM
#7
Addicted Member
have you tried the range thing in SQL...
SELECT whatever from tblWhatever where tblWhatever.orderdate > '$fromyear-$frommonth-$fromday 00:00:00' and customerinfo.orderdate < '$tooyear-$toomonth-$tooday 23:59:59'
fromyear, frommonth and fromday are just passed through a select box on the previous page but you could just capture today and add 30. Or am I totally off of what you're trying to do.
Last edited by TheGoldenShogun; Jun 24th, 2002 at 12:21 PM.
-
Jun 24th, 2002, 01:12 PM
#8
Thread Starter
Member
Way off. This worked:
Code:
SELECT * FROM messages WHERE date<NOW() - INTERVAL 30 DAY
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|