Re: Deleting from db
| From: | Folke Ashberg | Date: | Mon, 27 Nov 2000 18:29:23 +0000 |
| Subject: | Re: Deleting from db | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-27420@lists.php.net to get a copy of this message | ||
Hi!
Why you don't implement it with SQL:
mysql> SELECT something FROM table
WHERE TO_DAYS(NOW()) - TO_DAYS(date_col) <= 30;
refer to
http://www.mysql.net/documentation/mysql/bychapter/manual_Reference.html#Date_and_time_functions
regards
Folke
--
Folke Ashberg
Stage Internet Services GmbH
Technical Development
folke@fanstage.de
folke@fanstage.de | Tel: +49 89 454591-77 | Fax: +49 89 454591-71
Kreillerstr. 21 | 81673 Munich | Germany | www.fanstage.de
On Mon, 27 Nov 2000, Alan Todd wrote:
> i am trying to set up a page so when people submit data to it it will delete
> anything that is a week older or more
>
> i have the date entered in as
> $date = date(mj);
> $old = date( "mj", mktime(0, 0, 0, date(m), date(d)-7, 0));
>
> now how to match it up
> can i do < > in the db call or not
> so delete from user_temp where date > $old
>
> Thanks for the help
>
> Alan
>
>
>