delete record from DB on users selected end date
am 26.01.2006 12:48:19 von Gabe Garza
Hello,
I am trying to delete a record from my table when a php page is executed
I have various fields that are entered into a form, the two im guessing
which I need to use in my query are $date (automatically generated from
server) and an $endate which the user enters.
How do I go about deleting this record when the end date happens, I am
going to use CRON to trigger the php page once a day.
Many Thx
Re: delete record from DB on users selected end date
am 26.01.2006 13:21:59 von Shion
Spiral wrote:
> Hello,
>
> I am trying to delete a record from my table when a php page is executed
> I have various fields that are entered into a form, the two im guessing
> which I need to use in my query are $date (automatically generated from
> server) and an $endate which the user enters.
>
> How do I go about deleting this record when the end date happens, I am
> going to use CRON to trigger the php page once a day.
You can use cron to execute a delete-php-script, or you can let the script
that inserts new data to make a check and delete those that has gone old, this
would require that there are daily inserts or that you add a WHILE argument
for your search queries to not include old ones.
DELETE FROM mytable WHERE datecolumn < CURDATE()
//Aho