php - delete string date in mysql -
i have table on datebase: id, mark, date.
the date format this: dd.mm.yyyy (dd: 01-31, mm: 01-12, yyyy: 0000-9999)
i need write query mysql on php, delete line has difference between record , present time more 7 days. this:
mysql_connect($this->hostname, $this->username, $this->password) or die('could not select database.'); mysql_select_db($this->dbname) or die(mysql_error()); $query = "delete result date-".date('d.m.y')">7";//? mysql_query($query) or die(mysql_error());
how write correct query?
you can this:
delete result now()>`date` + interval 7 day
tip: not use function names , reserved words column or table names.
tip: not use mysql_* functions since officially deprecated
Comments
Post a Comment