Re: [PHP] How to delete 3 months old records in my database?

[email protected] (Dušan Novaković)
Newsgroups php.general
Message-ID <CAFY+RiEwXEgQSC5kw6+uvP3KEurTqMR-Tx=2k3uXb2E0Jm3-DA@mail.gmail.com>
$query = "DELECT FROM `__table_name__` WHERE `__date__` BETWEEN NOW() -
INTERVAL 3 MONTH AND NOW()"


On Fri, Aug 2, 2013 at 12:58 PM, Karl-Arne Gjersøyen <[email protected]>wrote:

> Hello again, folks!
> I wish to delete records in my database that is older than 3 months.
>
> $todays_date = date('Y-m-d');
> $old_records_to_delete =  ???
>
> if($old_records_to_delete){
> include(connect.php);
> $sql = "DELETE FROM table WHERE date >= '$old_records_to_delete'";
> mysql_query($sql, $connect_db) or die(mysql_error());
> }
>
> Thank you very much for your help to understand also this question :)
>
> Karl
>



-- 
mob:   + 46 7 230 230 19
web:   http://novakovicdusan.com

Please consider the environment before printing this email.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.