Hi all, I have an issue with a PHP and MySQL deletion script where I am basically trying to delete all records for meetings which have expired. For this, on input, I have a date input calendar which inputs the date in the format 2010-01-18 to the database with the column set to the date format. I then have the following PHP and MYSQL query to delete expired records:

<?php
$today = date("Y-m-d");
$meetingremoval = mysql_query('DELETE FROM meetings WHERE date < "$today"') or die (mysql_error());
?>

With this code however, nothing is deleted. I have output the $today variable to the screen and it is in the same format as is in the database but the stupid thing won't delete.

Any ideas?

Hi all, I have an issue with a PHP and MySQL deletion script where I am basically trying to delete all records for meetings which have expired. For this, on input, I have a date input calendar which inputs the date in the format 2010-01-18 to the database with the column set to the date format. I then have the following PHP and MYSQL query to delete expired records:

<?php
$today = date("Y-m-d");
$meetingremoval = mysql_query('DELETE FROM meetings WHERE date < "$today"') or die (mysql_error());
?>

With this code however, nothing is deleted. I have output the $today variable to the screen and it is in the same format as is in the database but the stupid thing won't delete.

Any ideas?

I Just solved my own problem with the following additions to my code :

$today = date("Y-m-d");
$meetingrquery= "DELETE FROM meetings WHERE date<'".$today."'";
$meetingremoval = mysql_query($meetingrquery) or die (mysql_error());
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.