not sure i completely understand your question but i think the user
enters a date, and you want to delete all records that match that date?
also i'm assuming that the entered date hits your script as a post
variable.
if so, you need to convert the posted date into the same format as the
records in the database and delete all matching records.
//convert the date.
$mysqlDate = preg_replace("|(\d{2})/(\d{2})/(\d{4)|", "\\3-\\2-\\1",
$_POST['strUserDate']);
//format the sql query
$strQuery = sprintf("delete from news where date = '%s',$mysqlDate);
then run the query.
tony
On Mon, 2005-09-12 at 12:56 +0100, ross@stripped wrote:
>
> I have a php/mysql database with articles. What I need is a php sctipt
> or some mysql that will compare the current day with the 'expiry
> date' entered by the user and if the there is a difference then drop
> it from the database..
>
> I am fairly new to mysql so do not know if there is a way to
> automatically drop records when they expire.
>
> I retrieve the date (called time) and format it like this...
>
> $query= "SELECT DATE_FORMAT(time, '%d.%m.%Y') AS time, article, id
> FROM news ORDER BY id DESC";
>
>
> The expiry date is entered through a javascript widget and is in the
> format dd/mm/yyyy.
>
>
> thanks,
>
>
> Ross
>
>
>
> www.blue-fly.co.uk | ross@stripped | 07816 996 930 | 0131 553
> 3935
>
>