This topic is locked
[SOLVED]

Deleting records in an table

5/28/2021 6:38:13 PM
PHPRunner General questions
J
Jan author

I want to delete the records from a table whose date is older than 180 days

HJB 5/28/2021

Execute an SQL query like this:

include("include/dbcommon.php");

CustomQuery("delete from TableName where now()>=end_date");

;

Sergey Kornilov admin 5/28/2021

SQL Query will be something liek this:

DELETE FROM myTable WHERE dateField < DATE_SUB(NOW(), INTERVAL 6 MONTH)

Replace myTable and dateField with the actual table and field names.

J
Jan author 5/30/2021

Works fine ! Thank you.