Forum Moderators: coopster
I was hoping for some help if possible?
I need to find a way to mark entries in the MYSQL DB as expired once the expired date has passed.
I plan on putting some code on the top of my front page so it can make this check whenever my site is loaded.
example of data in expiry_date column
2006-09-20 13:28:10
I am using a function to get the current date (it is stored in $currentdatetime variable), it is oputputting the date as:
2006-09-27 14:29:08
Would I use '<' Less than?
[php]
// run the query
$SQL = " UPDATE postings SET status = 'expired' WHERE expiry_date < LESS THAN? $currentdatetime";
[/php]
[php]
$SQL = " UPDATE postings SET status = 'expired' WHERE expiry_date < '$currentdatetime3'";
$R = @mysql_query ($SQL);
// check for error
if (!$R) { echo("ERROR: " . mysql_error() . "\n$SQL\n");
// Show errors, if any
ini_set ('display_errors', 1);
error_reporting (E_ALL & ~E_NOTICE);
}
[/php]