Jump to content

[SOLVED] Show Older Entries


lalabored

Recommended Posts

is sentdate a timestamp/date field? if so then look into date functions.  You can use any of your || && != > <  operators for comparisons of dates as long as your date is in the same format as the dates in the mysql database

this is a good reference to dates

http://www.w3schools.com/php/php_ref_date.asp

Try this:

 

<?php

mysql_query("SELECT * FROM `table` WHERE `sentdate` = Date() - 30")or die(mysql_error());

?>

 

That didn't work =S

 

I tried using this...

 

$old = mktime(0, 0, 0, date("m"), date("d")-1, date("Y"));
$q = "SELECT * FROM `p_messages_sent` WHERE UNIX_TIMESTAMP(sentdate) < $old";
$rs = mysql_query($q);

 

..to get rows that were older than 1 day (because I didn't have anything older than 30 days) but that didn't work =\

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.