Need help on find row with is 30 days old
Posted: Tue Dec 25, 2007 2:50 am
Hello PHP experts,
please help me with this...
I need to pull out data in mysql database for the row which are 30 days old.
I am storing the the date and time as "now()" in the "time" column and is timestamp structure.
My table name is "check"
Column
id name time
1 simon 2007-12-25 15:53:18
2 Jen 2007-12-25 15:53:18
3 Kenny 2007-11-14 15:53:18
4 Peter 2007-11-04 15:53:18
5 Ronny 2007-12-07 15:53:18
As you can see in this table there are 2 row which are 30 days and they are ID 3 and 4.
How can I check and pull out this data?
something like this..
thanks
please help me with this...
I need to pull out data in mysql database for the row which are 30 days old.
I am storing the the date and time as "now()" in the "time" column and is timestamp structure.
My table name is "check"
Column
id name time
1 simon 2007-12-25 15:53:18
2 Jen 2007-12-25 15:53:18
3 Kenny 2007-11-14 15:53:18
4 Peter 2007-11-04 15:53:18
5 Ronny 2007-12-07 15:53:18
As you can see in this table there are 2 row which are 30 days and they are ID 3 and 4.
How can I check and pull out this data?
something like this..
Code: Select all
$query = "SELECT id, name, time FROM check";
$strSQL = mysql_query($query);
while($row = mysql_fetch_array($strSQL)) {
if($row['time'] ???? how to do this part??) {
echo "$row['name'] is 30 days old<br>";
} else {
echo "Nothing to display";
}
}